Skip to content

Instantly share code, notes, and snippets.

View matthewhudson's full-sized avatar

Matthew Hudson matthewhudson

View GitHub Profile
@matthewhudson
matthewhudson / gist:4191461
Created December 2, 2012 22:56
DOM Selector WebPipe Block
var jsdom = require('jsdom');
var fs = require('fs');
var jquery = fs.readFileSync("./jquery.min.js").toString();
var Block = require('node-webpipe').Block;
var block = new Block()
.name("DOM Selector")
.description("Outputs selected content from a HTML DOM.")
.input("url", "string", "The location of the document to inspect.")
.input("selector", "string", "A jQuery-compatible DOM selector.")
@matthewhudson
matthewhudson / permisions.sh
Created January 8, 2013 21:22
UNIX permissions
# Recursively chmod only directories
find . -type d -exec chmod 755 {} \;
# Similarly, recursively set the execute bit on every directory
chmod -R a+X *
# The +X flag sets the execute bit on directories only
# Recursively chmod only files
find . -type f -exec chmod 644 {} \;
@matthewhudson
matthewhudson / style.css
Created January 29, 2013 20:13
OSX Lion hides scrollbars while not in use to make it seem more "slick", but at the same time the issue you addressed comes up: people sometimes cannot see whether a <div> has a scroll feature or not.
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
@matthewhudson
matthewhudson / pre-commit
Last active December 12, 2015 03:59
A pre-commit hook to minify JavaScript files and add them to staging.
#!/usr/bin/env node
var fs = require('fs');
var uglify = require('uglify-js');
var path = require('path');
var exec = require('child_process').exec;
var in_file = path.normalize(__dirname + '../../../infile.js');
var out_file = path.normalize(__dirname + '../../../outfile.min.js');
@matthewhudson
matthewhudson / division-test.coffee
Created March 10, 2013 23:15
VowsJS + CoffeeScript
vows = require 'vows'
assert = require 'assert'
vows
.describe('Division by zero')
.addBatch
'when dividing a number by zero':
topic: -> 42/ 0
'we get Infinity': (topic) ->
@matthewhudson
matthewhudson / text.js
Created March 12, 2013 20:18
Gently move <h1> downward on load.
<script type="text/javascript">
try{
Typekit.load({
active: function() {
$("h1").transition({ y: '33%' });
}
});
}
catch(e){}
fs = require 'fs'
{exec, spawn} = require 'child_process'
{series} = require 'async'
sh = (command) -> (k) ->
console.log "Executing #{command}"
exec command, (err, sout, serr) ->
console.log err if err
console.log sout if sout
console.log serr if serr
@matthewhudson
matthewhudson / README.markdown
Last active September 25, 2016 16:59
README Template

Description

Project Name is a...

For example ...

example code
@matthewhudson
matthewhudson / static-server.coffee
Last active December 15, 2015 08:19 — forked from ryanflorence/static_server.js
Run a static server from any directory.
http = require 'http'
url = require 'url'
path = require 'path'
fs = require 'fs'
port = process.argv[2] or 8888
headers =
'Content-Type': 'text/plain'
http.createServer( (request, response) ->
uri = url.parse(request.url).pathname
/* iPad in portrait & landscape */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* STYLES GO HERE */
}
/* iPad in landscape */
@media only screen
and (min-device-width : 768px)