Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
sebmarkbage / The Rules.md
Last active May 7, 2024 02:39
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@liuran001
liuran001 / config.yaml
Last active May 7, 2024 02:37
mihomo (Clash Meta) 懒人配置
# mihomo (Clash Meta) 懒人配置
# 版本 V1.5-240507
# https://gist.github.com/liuran001/5ca84f7def53c70b554d3f765ff86a33
# https://obdo.cc/meta
# 作者: 笨蛋ovo (bdovo.cc)
# Telegram: https://t.me/baka_not_baka
# 关注我的 Telegram 频道谢谢喵 https://t.me/s/BDovo_Channel
# 修改自官方示例规则 https://wiki.metacubex.one/example/#meta
# 转载请保留此注释
# 尽量添加了较为详尽的注释,不理解的地方建议对照 虚空终端 (Clash Meta) Docs 进行理解
@5ec1cff
5ec1cff / find_zip_entry.cpp
Created April 16, 2024 16:15
Find zip entry by offset
#include <cstdio>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstring>
#include <cerrno>
#include <string>
#include <utility>
@brazilnut2000
brazilnut2000 / Dapper Scalar Query.cs
Created August 17, 2015 20:46
Dapper: Execute Scalar query
int value = conn.Query<int>(sql, args).Single();
string value = conn.Query<string>(sql, args).Single();
http://stackoverflow.com/questions/8050636/is-there-an-executescalar-in-dapper
@gtechsltn
gtechsltn / Dapper Scalar Query.cs
Created May 7, 2024 02:34 — forked from brazilnut2000/Dapper Scalar Query.cs
Dapper: Execute Scalar query
int value = conn.Query<int>(sql, args).Single();
string value = conn.Query<string>(sql, args).Single();
http://stackoverflow.com/questions/8050636/is-there-an-executescalar-in-dapper
@brson
brson / gist:9dec4195a88066fa42e6
Last active May 7, 2024 02:34
A Rust Syntax Guide

A Guide to Rust Syntax

A very brief guide to Rust syntax. It assumes you are already familiar with programming concepts.

This was written in 2014. It is not a good reference for Rust today, though the content is still correct.

cheats.rs looks like a good alternative.

Assert macro

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 7, 2024 02:33
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@palewire
palewire / README.md
Last active May 7, 2024 02:29
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@PtruckStar
PtruckStar / Sticky note v3.3.js
Last active May 7, 2024 02:28
sticky notes widget with scriptable
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: sticky-note;
/*
#################################
####simple sticky note widget####
#################################
please read below for usage!!
you must configure font size and
@ih2502mk
ih2502mk / list.md
Last active May 7, 2024 02:25
Quantopian Lectures Saved