Skip to content

Instantly share code, notes, and snippets.

View jimthedev's full-sized avatar

Jim Cummins jimthedev

View GitHub Profile
// browserify
var browserify = require('browserify');
var es6ify = require('es6ify');
// gulp stuff
var gulp = require('gulp');
var livereload = require('gulp-livereload');
var source = require('vinyl-source-stream');
var jshint = require('gulp-jshint');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
@geraintluff
geraintluff / tv4-asyncFetchSchemas.js
Last active August 29, 2015 14:01
A little tv4 extension that can pre-fetch all required schemas.
tv4.asyncFetchSchemas = function (urls, callback) {
var activeRequests = 0;
var attemptedRequest = {};
if (!Array.isArray(urls)) urls = [urls];
function requestFinished(url) {
activeRequests--;
var missing = tv4.getMissingUris();
for (var i = 0; i < missing; i++) {
@shuhei
shuhei / 1_before.js
Last active August 29, 2015 14:17
Angular 2 annotation with babel (babel --experimental with experimental branch)
import {Component as _Component, Template as _Template} from 'angular2/src/core/annotations/annotations';
function makeDecorator(annotationClass) {
return (options) => {
return (klass) => {
klass.annotations = klass.annotations || [];
klass.annotations.push(new annotationClass(options));
return klass;
};
};
@robwormald
robwormald / angular2builds.md
Last active August 29, 2015 14:17
Angular2 2.0.0-alpha.18
  <script src="//jspm.io/system.js" type="text/javascript"></script>
  <script src="//code.innit.io/system.config.js" type="text/javascript"></script>
  <script src="//code.innit.io/zone.js" type="text/javascript"></script>
  <script src="//code.innit.io/angular2/angular2.js" type="text/javascript"></script>
/**
* RWHttp
*
* Base Class Used for making XHR/AJAX requests, uses the ES6 window.fetch API where available, or Github's polyfill.
*/
import {fetch} from './network/RWFetch';
import {RWHttpRequest} from './network/RWHttpRequest';
import {RWHttpResponse} from './network/RWHttpResponse';
import {RWHttpConfig} from './network/RWHttpConfig';
#! /bin/sh
# DESCRIPTION Setup wildcard domains using dnsmasq so *.doc is automatically sent to a running boot2docker vm
# MAINTAINER sxalexander@gmail.com
# See:
# https://echo.co/blog/never-touch-your-local-etchosts-file-os-x-again
# https://gist.github.com/r10r/5108046
# http://passingcuriosity.com/2013/dnsmasq-dev-osx/
# check for homebrew
if ! command -v brew >/dev/null; then
@nmn
nmn / VerExBabelPlugin.js
Last active January 21, 2016 03:40
A work in progress to make a Babel plugin that compiles VerbalExpression (nice library to create RegEx) into proper RegEx's at compile time
import VerEx from 'verbal-expressions';
const eventualCallIs = name => {
// FOR PERF
const boundCheck = node =>
node.type === 'Identifier' && node.name === name ||
node.type === 'MemberExpression' && boundCheck(node.object) ||
node.type === 'CallExpression' && boundCheck(node.callee)
return boundCheck;
@nolanlawson
nolanlawson / local-npm.md
Last active September 20, 2016 05:01
Setting up local-npm as a launch daemon on OS X

Setting up local-npm as a launch daemon on OS X

Update! There is now a script to do these steps for you.

These instructions will set up local-npm so that it runs as a launch daemon, meaning that it will start up whenever you log in.

First, install local-npm and pm2:

@davemo
davemo / route_manifest.js
Last active November 24, 2016 10:06
Maybe you want to add a global "resolve" property to all routes in an angular app, this is one way you could achieve that. I would probably still factor out the logic inside my app.config block into some sort of Service abstraction, but this should serve as enough of a general idea.
app.constant("RouteManifest", {
"/login" : {
templateUrl: 'templates/login.html',
controller: 'LoginController'
},
"/home" : {
templateUrl: 'templates/home.html',
controller: 'HomeController'
},
@bernharduw
bernharduw / list-item.js
Last active December 7, 2016 02:24 — forked from casesandberg/list-item.js
reactcss playground
import React from 'react';
import styled from 'styled-components';
const Item = styled.div`
margin-top: 1px;
padding: 15px;
background: #333;
${({first}) => first ? `
margin-top: 0;