var globule = require('./lib/globule');
globule.find([
'**/*.js',
'!**/*built.js',
'**/*.js',
'**/*.js',
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simplify testing things like regexes | |
function eqs() { | |
var a = [].slice.call(arguments); | |
var fn = a.pop(); | |
var i, actual; | |
for (i = 0; i < a.length; i += 2) { | |
actual = fn(a[i]); | |
if (actual !== a[i+1]) { | |
console.error('"%s" !== "%s" (%s)', actual, a[i+1], a[i]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
function toStringify(obj, toString) { | |
obj.toString = toString; | |
return obj; | |
} | |
grunt.initConfig({ | |
stuff: { | |
foo: ['l', 'o', 'l'], | |
bar: toStringify(['w', 'u', 't'], function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var globule = require('globule'); | |
// This actually looks for files '1' '2' etc, doesn't find them, | |
// but retains the pattern because nonull == true | |
console.log(globule.findMappingSync({ | |
src: '12345'.split(''), | |
nonull: true, | |
rename: function(n) { | |
return { | |
src: 'in/' + n + '.txt', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({}); | |
grunt.registerTask('require-wrapper', 'whatever', function() { | |
var done = this.async(); | |
var args = this.args; | |
// simulate async config building | |
setTimeout(function() { | |
// set config | |
grunt.config('requirejs', {yay: true}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When a jQuery deferred is resolved with a single value, the arguments to | |
// the .then callback are the same as when .then is called directly on the | |
// deferred or on $.when(deferred) AND ALSO $.when(deferred, deferred). | |
var dfd = $.Deferred().resolve([1, 2, 3]); | |
dfd.then(function(a) { | |
console.log('[1a]', a); // [1, 2, 3] | |
}); | |
$.when(dfd).then(function(a) { | |
console.log('[2a]', a); // [1, 2, 3] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
# this is a comment | |
"a": "hello", | |
# this is another comment | |
"b": -1, | |
"c": [ | |
true, | |
"test", | |
null | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instead of lots of "if err, callback(err), else, callback(null, result)" | |
exports.doSomething = function(callback) { | |
var err, result; | |
// a bunch of code | |
if (err) { | |
callback(err); | |
} else { | |
callback(null, result); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat package.json | |
{ | |
"name": "globule", | |
"description": "An easy-to-use wildcard globbing library.", | |
"version": "0.1.0", | |
"homepage": "https://github.com/cowboy/node-globule", | |
"author": { | |
"name": "\"Cowboy\" Ben Alman", | |
"url": "http://benalman.com/" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. download ts3 Server x86 from: http://www.teamspeak.com/?page=downloads | |
# 2. run this script as root from within /opt/ | |
# notes: | |
# http://robert.penz.name/296/howto-install-teamspeak-3-server-on-ubuntu-10-04-lucid/ | |
if [[ ! "$1" || ! -e "$1" ]]; then | |
echo "Usage: $(basename $0) teamspeak3-server_linux-x86-x.y.z.tar.gz" |