Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
var each = function(arr, cb){
var i = 0, len = arr.length;
for(; i < len; i++) {
if(cb(arr[i]) === false) {
return;
}
}
};
var baseImport = System.import;
@marshallswain
marshallswain / gist:2ff968cbeef8817e789b
Created May 11, 2015 16:52
Errors with DocumentJS in package.json
Marshalls-MacBook-Pro:funcunit-test marshallthompson$ steal-tools build
OPENING: /Users/marshallthompson/Sites/funcunit-test/package.json!npm
WARN: Could not find dojo/dojo in node_modules. Ignoring.
WARN: Could not find yui/yui in node_modules. Ignoring.
WARN: Could not find mootools/mootools in node_modules. Ignoring.
WARN: Could not find zepto/zepto in node_modules. Ignoring.
WARN: Could not find steal-qunit/steal-qunit in node_modules. Ignoring.
WARN: Could not find steal-qunit in node_modules. Ignoring.

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@marshallswain
marshallswain / layout.mustache
Last active August 29, 2015 14:21
DocumentJS layout with menu
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="en">
<![endif]-->
<!--[if IE 7]>
<html class="no-js ie lt-ie9 lt-ie8" lang="en">
<![endif]-->
<!--[if IE 8]>
<html class="no-js ie lt-ie9" lang="en">
@marshallswain
marshallswain / nginx.conf
Created May 27, 2015 05:05
NginX minimal virtual host configuration for StriderCI
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@marshallswain
marshallswain / live-binding-opt-out.js
Created July 5, 2015 21:36
Live Binding Opt Out Helper
// Opt out of live binding by not using the property's compute.
// Usage: {{~ 'propName'}}
can.stache.registerHelper('~', function(prop, options) {
return options.context[prop];
});
@marshallswain
marshallswain / validation.stache
Last active September 22, 2015 21:34
Validation Ideas
viewModel = {
// Added implicitly
validation: {
comment: [],
username: {
required: "Username is required."
}
}
@marshallswain
marshallswain / qtip.stache
Created January 28, 2016 18:25
qtip2 idea
https://www.npmjs.com/package/qtip2
<td qtip>content</td>
<div class="qtip">here is popover content</div>
<td qtip qtip-selector="qtip">content</td>
<td>
content
@marshallswain
marshallswain / example-usage.js
Last active May 17, 2022 00:34
A FeathersJS hook to implement `findOrCreate`
const findOrCreate = require('./hook.find-or-create.js')
app.service('messages').hooks({
before: {
create: [findOrCreate()]
}
})
@marshallswain
marshallswain / feathersjs-auth0.js
Created June 4, 2016 20:49 — forked from theevangelista/feathersjs-auth0.js
A hook to populate an user from Auth0 into feathersjs
const request = require('request-promise');
const errors = require('feathers-errors');
const options = {
idField: 'sub',
issuer: 'iss'
};
module.exports = function() {