Skip to content

Instantly share code, notes, and snippets.

View IanVS's full-sized avatar

Ian VanSchooten IanVS

View GitHub Profile
@jhliberty
jhliberty / ember-config-environment.js
Created June 12, 2015 03:21
Basic JWT Auth for Seeds.js/Sane Stack (aka Ember on Sails)
var ENV = {
modulePrefix: 'frontend',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
# Add this to .zshrc for VIM modes in shell....holy shit, amazing!!!!
# although this does effect the ability to scroll through bash history with ctlr+p, ctrl+n, if ctrl is remapped to cap locks via
# system preferences
bindkey -v
# preferences > keys -- hotkey to open iterm = option+space
# preferences > keys -- change hotkeys for moving previous/next tabs to more similar to VIM, combo with h (previous) l (next)
# preferences > profiles > keys -- right and/or left option key to +Esc, allows easier navigating of words in command line
commands:
@mphasize
mphasize / beforeBlueprint.js
Created March 2, 2015 12:31
Sails-beforeBlueprint-Policy
/**
* beforeBlueprint
*
* @module :: Policy
* @description :: Simple policy to enable hooks into the model which can act upon req, res objects.
* @docs :: http://sailsjs.org/#!documentation/policies
*
*/
var actionUtil = require( 'sails/lib/hooks/blueprints/actionUtil' );
@jmreidy
jmreidy / test_mocha.opts
Last active January 9, 2018 11:49
Unit test React Native with Mocha
--compilers js:./test/support/compiler
--require ./test/support/init
@LeoCavaille
LeoCavaille / .gitconfig
Last active June 23, 2020 09:17
How to properly rebase and deal with a contributor's PR
[alias]
checkoutpr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; git checkout pr/$1; } ; f"
checkoutcontrib = "!f() { git checkout master && git pull && git remote add $1 git@github.com:$1/dd-agent && git fetch $1 $2 && git checkout -b $3 $1/$2 && git rebase master } ; f"
@uhho
uhho / node nginx configuration
Created October 4, 2013 01:16
Sample nginx configuration for NodeJS + SocketIO app
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@shilman
shilman / mdx-v2-sb-6.5.md
Last active March 20, 2023 15:05
Experimental MDXv2 Support in Storybook 6.5

Experimental MDXv2 Support in Storybook 6.5

The MDX team has just released the long-awaited MDXv2 with dramatically better syntax and performance. It's a huge win for the community! 🎉

Now I'm excited to announce experimental support in Storybook 6.5. This gist summarizes how to try it out, how to report bugs, and known gotchas that you might encounter along the way.

Installation

Since MDXv2 is a breaking change, it's an opt-in feature in Storybook 6.5.

@benjie
benjie / npm-wrong-tag.md
Created July 26, 2017 12:16
Resolve publishing npm package to wrong tag

If you accidentally publish a package to the wrong tag (e.g. @latest when you meant to tag it as @next) you can resolve as follows:

npm show PACKAGE_NAME versions # To view the versions you've published
npm dist-tags add PACKAGE_NAME@NEW_VERSION next # Tag the new package version as `@next`
npm dist-tags add PACKAGE_NAME@OLD_VERSION latest # Restore the correct `@latest` to be your previous release version