Skip to content

Instantly share code, notes, and snippets.

View zhigang1992's full-sized avatar
:octocat:
Focusing

Kyle Fang zhigang1992

:octocat:
Focusing
View GitHub Profile
import Observation
@Observable
final class ObservableDictionary<Key: Hashable, Value> {
@ObservationIgnored fileprivate var backingDictionary: Dictionary<Key, Value> = [:]
public subscript(key: Key) -> Value? {
get {
let keyPath = \ObservableDictionary<Key, Value>.backingDictionary[key]
access(keyPath: keyPath)
@zhigang1992
zhigang1992 / renderRect.js
Created January 1, 2020 15:14 — forked from mlewand/renderRect.js
DOMRect visualisation - a small helper for visualizing DOMRect objects.
( function() {
/**
* A helper function to visualize DOMRect or set of DOMRect instances.
*
* Subsequent calls will remove previously marked elements.
*
* Debug a element currently focused in your devtools inspector.
* window.markRect( $0.getBoundingClientRect() );
* // Debug a selection.
* window.markRect( document.getSelection().getRangeAt( 0 ).getClientRects() );
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO2VOFP8l4mmyi04MwHOYyswr0dweS2GEbRslQnqsw5dY1Xfs+oWszevPeGJ6KRsCnd/ir7P+yrEOLK7GeybMqHMoIL0Ue6A+u8f+GtsfEGaH9TyWaNTmaXsmE45UY7m1Sz14rp5uITW7AYkP4b1aH5UWQmXloSWsCJDcQsViX4wKr9xqazZ8ThRy7uMTKnCD1sWRtPUGSV9PQ+Wj7Vh6BJO140JPyxp9NAIwt1G5zxWAJblcYicAzxiNcq76H46N3P59C1v1dUmsVNJRMdtGq2pfr4jY80JpUx86Scy9V10dy18zjwQBYRTtJwvqZ0xjfXtn+AeR+I7Or1Tvb0ev1 zhigang1992@gmail.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4aiQfU9mpfjB6hDC1+JXmNHCOfg8r2stRZY3xodGp9+W6IIfxDZ5Yz2Nx1DgEvTNCpJSnBpwoyOJ0/zsdVt0H3SLfwPewPGZFoZdTQn9JRmS/vFLYVChtfDbkw33XqyV3H9tT53bQG5K6O3+vbwfOjIXkDi4E/qoEgvOR5UG6Ey6KPLVb7w/6AePGQe+cL1CAip0i/kEwkyh0U3BrPtuV5WoUeCgJx9ihkmYEu9ecCie50N7Q48gWp8D72ivOyv9AVFsFyjEJDBgvVS5R2Muag/LIrylEsQY9o1ow5wFMztaACPGSoc0+8NM9FsW9HUImwl5M94WRzr3FHBAcnU3h macpro@Macs-Mac-Pro.local
@zhigang1992
zhigang1992 / watermark.command
Last active August 15, 2018 03:59
Watermarking folders of images. imagemagick required
#!/bin/bash
# Put your files in origin folder
cd `dirname $0`
mkdir -p watermarked/origin
find origin -type d > watermarked/.dirs.txt
pushd watermarked
@zhigang1992
zhigang1992 / packages.json
Created March 27, 2018 11:58
blockchainbootstrap
{
"name": "awesomeblockchainapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.1.1"
},
"scripts": {
@zhigang1992
zhigang1992 / StateFarm.ipynb
Created January 19, 2018 08:58
Learning/Lesson1/StateFarm.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@font-face {
font-family: "Fira Code Patched";
font-style: normal;
font-weight: 200;
src: url('https://cdn.rawgit.com/ryanoasis/nerd-fonts/1.2.0/patched-fonts/FiraCode/Light/complete/Fura%20Code%20Light%20Nerd%20Font%20Complete.otf') format('opentype');
}
@font-face {
font-family: "Fira Code Patched";
font-style: normal;
font-weight: 400;
myModifierMode = hs.hotkey.modal.new()
function binderToMods(from,to,mods,toMods)
local function f ()
myModifierMode.triggered = true
hs.eventtap.keyStroke(toMods, to, 1000)
end
myModifierMode:bind(mods, from, f, nil, f )
end
@zhigang1992
zhigang1992 / index.d.ts
Created May 23, 2017 10:50 — forked from hktonylee/index.d.ts
Typescript Typing Definition for react-native-fbsdk
declare module "react-native-fbsdk" {
import * as React from 'react'
export interface LoginResult {
isCancelled: boolean,
grantedPermissions?: Array<string>,
declinedPermissions?: Array<string>,
}
export type DefaultAudience = 'friends' | 'everyone' | 'only_me';