Skip to content

Instantly share code, notes, and snippets.

View oswaldoacauan's full-sized avatar
🔮
Snapshot tests are bad. Change my mind.

Oswaldo Acauan oswaldoacauan

🔮
Snapshot tests are bad. Change my mind.
View GitHub Profile
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@janpipek
janpipek / input-storage.js
Created June 19, 2013 09:56
Auto-store state of input elements in localStorage (jQuery)
/**
* Simple jQuery utility for saving element values in localStorage.
*
* Usage:
* - Add class "store-state" to the element you want to save.
* - Add id attribute to the element or specify your own storage key (attribute data-storage-name)
* - Add attribute "data-storage-name" to the element if you
* want to control under which name the value will be stored
* - Add attribute "data-storage-noload" to suppress loading (will be stored though, it is
* useful, when HTML-specified value is temporarily more important).
@sebastianseilund
sebastianseilund / merged_array.js
Last active December 20, 2015 07:58
An implementation of a merged array in Ember.js that combines items from multiple source arrays so you can easily list them together in your Handlebars templates. Read the blog post at the [Billy's Billing Developer Blog](http://dev.billysbilling.com/blog/How-to-merge-multiple-data-sources-into-one-array-in-Ember-js)
/**
* `Ember.MergedArray` is an array that observes multiple other arrays (called source arrays) for changes and includes
* all items from all source arrays in an efficient way.
*
* Usage:
*
* ```javascript
* var obj = Ember.Object.create({
* people: [
* {
@jayphelps
jayphelps / resolver.js
Last active September 4, 2020 17:56
Example of using multiple Ember.Namespaces with a custom Ember.Resolver to reuse code between projects. Ember App Kit's resolver as another example: https://github.com/stefanpenner/ember-jj-abrams-resolver DefaultResolver docs: https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/resolver.js
/**
* Super namespace that all our libs and apps will live on. We also extend all
* of the native Ember classes as well and exclusely use them that way so we can
* alter the behavior in one place without needing to reopen the original class.
*
* We call the super namespace PS for Pivotshare, call it what you'd like.
*/
window.PS = Ember.Namespace.create();
// Create our custom resolver so we can have Ember look up classes on multiple
@kamilio
kamilio / custom-thunk.js
Created May 10, 2016 16:08
Redux, eventBus solved with middlewares or without
// *** Middleware - custom thunk implementation (slightly diffferent though) - maybe more scalable appraoch
export default function createEventBusMiddleware(eventBus) {
return ({ dispatch, getState }) => (next) => (action) => {
// we could optimize further here and use rest operator to get all arguments and compose the middlewares
if (typeof action === 'function') {
return action({ dispatch, eventBus, getState });
}
return next(action);
};
@iammerrick
iammerrick / PinchZoomPan.js
Last active April 22, 2024 02:54
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@rdickert
rdickert / meteorHoc.js
Last active May 16, 2018 14:18
Create single-prop HOCs for Meteor
// Creating Meteor HOCs
import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import React from 'react';
import { compose } from 'recompose';
// Assuming we have a Meteor collection here...
import TodosCollection from '../api/TodosCollection';
@danielroe
danielroe / settings.json
Last active November 16, 2024 15:21
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",