Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile

Right Notes

Coding Conventions

Whitespace

  • Always spaces, never tabs
  • 2 spaces indents
@daffl
daffl / less-system.js
Created August 19, 2015 20:16
A LESS JS system plugin
var less = require('less');
exports.translate = function(load) {
return less.render(load.source).then(function(output) {
return output.css;
});
}
exports.instantiate = function(load) {
load.metadata.format = 'css';
@matthewp
matthewp / system.cache.js
Created March 24, 2015 02:13
system-cache.js
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;
@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

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.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@daffl
daffl / bower.json
Last active April 20, 2017 12:14
Mocha + FuncUnit
{
"name": "funcunit-dmeo",
"version": "0.0.0",
"main": "lib/index.js",
"license": "ISC",
"private": true,
"devDependencies": {
"mocha": "~1.15.0",
"chai": "~1.8.1",
"funcunit": "git://github.com/bitovi/funcunit.git#abeedf7e7e75445e0ef6bb82a8cef250664d4c67"
@cultofmetatron
cultofmetatron / gist:5349630
Created April 9, 2013 21:38
passport ajax capable authenticate
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
if (!user) { return res.json({error : "Invalid Login"}); }
req.login(user, {}, function(err) {
if (err) { return res.json({error:err}); }
return res.json(
@alexjamesbrown
alexjamesbrown / server.js
Created August 6, 2012 16:28
Example server.js for LocomotiveJS app
var locomotive = require('locomotive'),
env = process.env.NODE_ENV || 'development',
port = process.env.PORT || 3000,
address = '0.0.0.0';
locomotive.boot(__dirname, env, function(err, server) {
if (err) { throw err; }
server.listen(port, address, function() {
var addr = this.address();
console.log('listening on %s:%d', addr.address, addr.port);