Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
@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);
@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(
@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"
@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.
@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;
@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';

Right Notes

Coding Conventions

Whitespace

  • Always spaces, never tabs
  • 2 spaces indents
@justinbmeyer
justinbmeyer / crazycon.md
Last active November 23, 2015 20:12
crazy connection stuff

Using Session

Behavior

var isSession = require("is-session")

behavior("uses-session", function(base){
	
	return {
@leoj3n
leoj3n / Bootstrap--The-Good-Parts.md
Last active April 12, 2017 15:03
Bootstrap: The Good Parts

Bootstrap is hard to customize and rather bulky; when you enclude the entire library on your page, rarely are you utilizing all of the parts. Luckily, with the help of StealJS, we can load just the needed parts within a DoneJS application ON DEMAND and NON-DESTRUCTIVELY. You know how difficult it can be if you've tried to accomplish this in the past with old versions of Bootstrap within a framework of your choice. Well, if you're willing to adopt DoneJS (or at least the module loader StealJS), you'll be off to the races with a lightweight app that loads just the bare minmium of needed CSS and JS.

This guide will be broken into parts:

  • Installing DoneJS
  • Generating a new DoneJS project
  • Installing Boostrap v4
  • Installing Tether
  • Generating a new DoneJS component
  • Editing the package.json
@john-evangelist
john-evangelist / feathersjs-auth0.js
Last active March 7, 2017 06:19
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() {