Skip to content

Instantly share code, notes, and snippets.

View marionebl's full-sized avatar

Mario Nebl marionebl

View GitHub Profile
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
@sindresorhus
sindresorhus / .profile
Created April 6, 2016 11:10 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@ZauberNerd
ZauberNerd / create-trap.js
Last active December 12, 2015 01:33
Property trap (inspired by ES6 proxies)
function isObject(test) {
return Object.prototype.toString.call(test) === '[object Object]';
}
function trap(host, targetName, handler) {
const prison = {};
let cell = {};
Object.defineProperty(prison, targetName, {
configurable: true,
@bomberstudios
bomberstudios / sketch-diff-in-git.md
Last active May 17, 2024 02:53
How to diff your .sketch files in Git

Using sketchtool to diff your .sketch files using text

Requirements

You need to have SketchTool installed somewhere in your path.

Setup

Add this in your ~/.gitconfig file (for some reason, it won't work in a local .gitconfig file):

/// <reference path="typings/node/node.d.ts" />
/// <reference path="typings/typescript/typescript.d.ts" />
import ts = require("typescript");
import fs = require("fs");
import path = require("path");
function transform(contents: string, libSource: string, compilerOptions: ts.CompilerOptions = {}) {
// Generated outputs
var outputs = [];
@ZauberNerd
ZauberNerd / critical-selectors.js
Created March 11, 2014 09:39
Extract all matching selectors for elements above-the-fold.
/* jslint browser:true, devel:true */
(function () {
'use strict';
if (typeof Element.prototype.matches !== 'function') {
var proto = Element.prototype;
var matches = proto.matches ||
proto.webkitMatchesSelector ||
proto.mozMatchesSelector ||
@ZauberNerd
ZauberNerd / atf-css.js
Last active April 12, 2016 12:22
Generates CSS for all elements currently in the viewport (Above The Fold) (unstable and hacky, needs more refactoring).
(function () {
'use strict';
var CSSCriticalPath = function (w, d) {
var css = {};
var findMatchingRules = function (node, pseudo) {
var rules = w.getMatchedCSSRules(node, pseudo);
var duplicate = false;
var rulesArr = null;
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@TooTallNate
TooTallNate / mouse.js
Created January 30, 2012 05:55
Enable "mouse reporting" with Node.js
// Based on:
// http://groups.google.com/group/nodejs-dev/browse_thread/thread/a0c23008029e5fa7
process.stdin.resume();
process.stdin.on('data', function (b) {
var s = b.toString('utf8');
if (s === '\u0003') {
console.error('Ctrl+C');
process.stdin.pause();
@RandomEtc
RandomEtc / README.mkd
Created September 28, 2010 00:11
smooth panning and zooming for polymaps