Skip to content

Instantly share code, notes, and snippets.

View jswartwood's full-sized avatar

Jacob Swartwood jswartwood

View GitHub Profile
@jswartwood
jswartwood / Gruntfile.js
Created July 22, 2014 22:09
Sails v0.9.x Gruntfile to include support for Web Components and Jade, Stylus, & ES6 preprocessing (including within components)
/**
* Gruntfile
*
* If you created your Sails app with `sails new foo --linker`,
* the following files will be automatically injected (in order)
* into the EJS and HTML files in your `views` and `assets` folders.
*
* At the top part of this file, you'll find a few of the most commonly
* configured options, but Sails' integration with Grunt is also fully
* customizable. If you'd like to work with your assets differently
@jswartwood
jswartwood / gist:5184574
Created March 18, 2013 02:26
NPM cb() never called!
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.0
Using npm version: 1.2.12
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm info it worked if it ends with ok
npm verb cli [ '/tmp/node-node-wI96/bin/node',
@jswartwood
jswartwood / Premise.md
Created March 15, 2012 14:22 — forked from samtsai/Premise.md
AE Code Golf #1

Fibonacci Sequence

Classics series

Print the Fibonacci series (the first 10 values) separated by spaces. If you've ever taken a Computer Science class, you should be all over this one.

@jswartwood
jswartwood / Premise.md
Created March 13, 2012 14:53
AE Code Golf #1

Fibonacci Sequence

Classics series

Print the Fibonacci series (the first 10 values) separated by spaces. If you've ever taken a Computer Science class, you should be all over this one.

@jswartwood
jswartwood / Premise.md
Created March 13, 2012 14:46
AE Code Golf #2

Get/Set JSON in a cookie

Provide methods to store and retrieve a JSON object in a cookie named "data". The store method should stringify the JSON, and the retrieve should parse back to an object. Cookie properties include: path, domain, and expires. Properties should be somehow configurable (eg. params, a config method). All properties should have default values: path = "/", domain = ".ae.com", expires at the end of session.

@jswartwood
jswartwood / Run in LOCAL terminal...
Created February 19, 2012 01:53
Automatic Git deploys on Dreamhost
# Replace any brackets with real values
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal
ssh [user]@[host]
cd ~
mkdir [mydomain_com].git
cd [mydomain_com].git
git init --bare
vi hooks/post-receive
# Enter the code from the "post-receive" file (in this gist); save + quit
@jswartwood
jswartwood / local-build-tools.js
Created January 6, 2012 19:36
Example use-case for and1
var fs = require("fs")
, andOne = require(process.env.AEO_BIN + "/lib/andOne.js")
;
// ==============
// Define Actions
// ==============
module.exports = {
// Set the build infomation as the SVN CWD
@jswartwood
jswartwood / index.html
Created January 6, 2012 14:30
Hiccup?
<!DOCTYPE html>
<html>
<body>
<p>These should output "last", "ok", then "all" for 10 promises and then another 10.</p>
<div id="out"></div>
<script type="text/javascript" src="https://raw.github.com/briancavalier/when.js/dev/when.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
@jswartwood
jswartwood / truthy-eq-good-times.js
Created June 21, 2011 02:17 — forked from cowboy/truthy-eq-good-times.js
JavaScript: See what == what!
// This should do a pretty good job of iterating through the following array
// and logging any values that == each other. Beware, this is scary stuff!
// http://benalman.com/news/2010/11/schrecklichwissen-terrible-kno/
var arr = [true, 123, {}, {a:1}, [], [0], [123], "hi", function foo(){},
/re/, false, 0, "", null, undefined, NaN];
function pretty(v) {
var s = JSON.stringify(v);
return v == null ? v + "" : s === undefined ? v : s == "null" ? "NaN" : s;