Skip to content

Instantly share code, notes, and snippets.

@mikemichaelis
mikemichaelis / gist:4f6d62a03300a24e97c1d19b9413371e
Created April 19, 2017 14:30
Setup p4merge as git mergetool in Windows (cmd & PS)
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
@Yimiprod
Yimiprod / difference.js
Last active April 5, 2024 13:17
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@dherman
dherman / realms-api.md
Last active March 8, 2024 07:04
ES6 Realms API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Realms

@dherman
dherman / loader-api.md
Last active January 31, 2019 03:02
Complete ES6 Loader API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Loaders

@dherman
dherman / template-literals.md
Last active July 4, 2021 10:41
What can you do with ES6 string template literals?

DOM selectors

var elements = query`.${className}`;

Localization

var message = l10n`Hello ${name}; you are visitor number ${visitor}:n!
@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.

@drawcode
drawcode / WebWindow.cs
Created January 22, 2013 18:11
Unity WebWindow (browser within unity editor window, helpful for tools that require a web view or more beyond basic controls).
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
public class WebWindow : EditorWindow {
static Rect windowRect = new Rect(100,100,800,600);
static BindingFlags fullBinding = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
static StringComparison ignoreCase = StringComparison.CurrentCultureIgnoreCase;
@divanvisagie
divanvisagie / system.js
Last active December 10, 2015 05:48
The system function attempts to bring the C system() function to node.js with extended functionality. system() executes a command and fires an event when done that will return the command output. system has 2 events: 'data' - returns the output data of the command 'exit' - returns command exit code dependancies npm install colors Examples of the…
/* License MIT */
var spawn = require( 'child_process' ).spawn,
colors = require( 'colors' );
/*
Executes a command and fires event when done that
will return the command output
*/
function system( cmd ){
@tivac
tivac / _README.md
Last active October 4, 2015 11:38
Parent/Child Y.View extension

Parent/Child Y.Views

As I worked with Y.App it became clear that while Y.View is a great abstraction it would be easy to overwhelm a single instance with way too much functionality. This is my attempt to solve that issue by allowing multiple child views to be attached to a single parent view via an extension.

Usage

The extension is mixed into the parent view like any other extension using Y.Base.create.

var Parent = Y.Base.create("view", Y.View, [