Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / grunt-wat.js
Created April 18, 2012 19:00
I'm not even joking.
// This was what I got, pasted into an email.
module.exports = function(grunt) {
//Grunt Globals
var ConcatOutputFileNameAndLocation="c:\\TestOutput.js";
var JavascriptDirectory = 'C:\\Work\\Patch29\\StaticContent\\RootAssets\\JsLib'
var MessageTaskStart = "StartingTask_";
var MessageTaskEnd = "EndingTask_";
var MessageTaskERR = "Error_";
var MessageTaskReturnObjectValue = "ReturnObjectValue_";
@cowboy
cowboy / grunt.js
Created April 18, 2012 12:01
For matjas
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
'meta': {
'banner': '/*! LOL PENIS | <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */',
srcfiles: [
'js/libs/jquery-1.7.2.js',
'js/libs/jquery.placeholder.js',
'js/main.js',
@cowboy
cowboy / grunt-talk.wat
Created April 17, 2012 14:35
jqcon grunt talk
Titles:
Improving your workflow with grunt
The grunt development workflow
Using grunt to make your life easier
The sweet, sweet sound of "grunt"
Learn to "grunt" without breaking a sweat
Using grunt to grunt your grunt
GRRRRRRRRUUUUNNNNNNNTTTTTT?!
@cowboy
cowboy / function-makecallbackable.js
Created April 14, 2012 15:52
JavaScript Function#makeCallbackable
/*
* Function#makeCallbackable
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
Function.prototype.makeCallbackable = function() {
var fn = this;
@cowboy
cowboy / callbackify.js
Created April 14, 2012 15:25
JavaScript callbackify
/*
* callbackify
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
function callbackify(fn, args, done) {
// If the function arity exceeds args length, it's accepts a "done" callback.
@cowboy
cowboy / runme.sh
Created April 5, 2012 21:43
Linkify every H2+ in *.md MarkDown files with a ⚑ for GitHub-friendly deep-linking.
ruby -pi -e '$_.gsub!(/(##+)\s+(.*?)\s*\n/){a,b=$1,$2;name=b.downcase.gsub(/\W+/,"-").gsub(/^-|-$/,"");%{#{a} #{b} <a name="#{name}" href="##{name}" title="Link to this section">⚑</a>\n}}' *.md
// Process a file as a template.
grunt.registerHelper('file_process', function(filepath, opts) {
var src = file.read(filepath);
return grunt.template.process(src);
});
@cowboy
cowboy / grunt-init.exp-output.txt
Created March 23, 2012 20:06
Expect: the best thing EVER
[master][cowboy@CowBook:/Volumes/Data/Dropbox/Projects/Repos/cowboy/grunt]
[16:05:20] $ ./dev/init.exp
spawn bash --noprofile --norc
bash-3.2$ PS1='
> $ '
cd /tmp
$ cd /tmp
rm -rf /tmp/grunt-jquery-example
@cowboy
cowboy / grunt-noglobals-merge.txt
Created March 23, 2012 01:22
git merge noglobals (just a few changes)
Updating a0dfb40..cafc7f3
Checking out files: 100% (73/73), done.
Fast-forward
docs/api.md | 402 ++++++++++-
docs/api_config.md | 94 +++
docs/api_fail.md | 35 +
docs/api_file.md | 161 ++++
docs/api_log.md | 120 +++-
docs/api_task.md | 416 +++++++++++
docs/api_template.md | 72 ++
@cowboy
cowboy / safety-syntax-comment.js
Created March 21, 2012 16:03
Finding a "safety syntax" for classes
// This code example was seen here:
// https://mail.mozilla.org/pipermail/es-discuss/2012-March/021430.html
class Horse extends Animal {
constructor(name){
super(name);
}
move() {
alert("Galloping...");
super.move(45);