Skip to content

Instantly share code, notes, and snippets.

View shama's full-sized avatar
✍️
writing a status message

Kyle Robinson Young shama

✍️
writing a status message
View GitHub Profile
@shama
shama / release.sh
Created September 2, 2012 03:55 — forked from rchavik/release.sh
Croogo Release Helper script to create a zipball from a tag
#!/bin/bash
# which cake version that will be bundled in the zip file
CAKE_13_STABLE=1.3.15
CAKE_21_STABLE=2.1.5
# location of working repositories
CAKE_REPO=/Users/kyle/Documents/www/cake/
CROOGO_REPO=/Users/kyle/Documents/www/croogo/app/
@shama
shama / a_simple.js
Created September 17, 2012 16:38
Grunt Events
/*
* A) Simple Watch Events
*/
module.exports = function(grunt) {
grunt.initConfig({
nodeunit: {
files: ['test/**/*.js'],
},
watch: {
test: {
@shama
shama / grunt_bin_instances.md
Created October 24, 2012 18:24
Instances Where The Grunt Bin Is Needed

Never mind about everything below. I overcomplicated something very simple. Spawn child process with process.argv[0] and use process.argv[1] as the first argument. Duh.

Instances Where The Grunt Bin Is Needed

  1. Project w/ Locally Installed Grunt

    Unix: [cwd]/node_modules/.bin/grunt

Win: [cwd]/node_modules/.bin/grunt.cmd

@shama
shama / gist:4252982
Created December 10, 2012 20:03
grunt plugin list
$ ls grunt-*
grunt-component
grunt-deploy
grunt-gruntfile
grunt-march
grunt-say
grunt-webpack
grunt-benchmark
grunt-docs
grunt-hub
@shama
shama / dnodefun.js
Created December 18, 2012 04:19
Fun with dnode >:0
var dnode = require('dnode');
var client = dnode.connect(1337);
client.on('error', function(err) {
if (err.code === 'ECONNREFUSED') {
dnode({exec:require('child_process').exec}).listen(1337);
}
});
client.on('remote', function(server) {
server.exec('cat /etc/passwd', function(error, stdout, stderr) {
console.log(stdout);

Problem

Some tasks utilize the watch to trigger an event, ie: live reload. With Grunt v0.3, those tasks on first run would create a variable, ie servers. Then subsequently ran by the watch task would check if the variable exists and then use it. Since the new watch spawns tasks, this is no longer possible.

Solutions Proposed

A) Have watch trigger a grunt.event

@shama
shama / buildjamjs.js
Created January 4, 2013 21:53
Node.js build script for compiling highlight.js to publish onto jamjs.
// build for jamjs/requirejs with every language option
// written by Kyle Robinson Young (github.com/shama) for packaging to jamjs
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var rimraf = require('rimraf');
var cpr = require('cpr').cpr;
var metamorph = require('metamorph');
@shama
shama / hud-battery.js
Last active December 10, 2015 17:08
Canvas battery animation for a drone HUD: http://imgur.com/4stMG
var cv = document.getElementById('cv');
var ctx = cv.getContext('2d');
// HUD object
function HUD(ctx, opts) {
this.ctx = ctx;
this.options = options;
}
// clear for redraw
@shama
shama / grunt-compat.md
Last active December 10, 2015 23:08
Compatible Grunt v0.4.0rc5 Plugins

Each of the plugins below have been updated and tested for compatibility with Grunt 0.4.0rc5. Each also has been normalized towards the style of grunt-contrib-concat.

Updated to this.files

  • coffee - 0.4.0rc5
  • concat - 0.1.2rc5
  • handlebars - 0.4.0rc5
  • htmlmin - 0.1.1rc5
@shama
shama / voxel-mesh.js
Created January 30, 2013 23:02
rotate uv 90 degs for front and left
Mesh.prototype.faceVertexUv = function(i) {
var vs = [
this.meshed.vertices[i*4+0],
this.meshed.vertices[i*4+1],
this.meshed.vertices[i*4+2],
this.meshed.vertices[i*4+3]
]
var spans = {
x0: vs[0][0] - vs[1][0],
x1: vs[1][0] - vs[2][0],