Skip to content

Instantly share code, notes, and snippets.

View cmcculloh's full-sized avatar

Christopher McCulloh cmcculloh

View GitHub Profile
@cmcculloh
cmcculloh / gist:7324287
Created November 5, 2013 19:04
this goes in grunt.js
// Launch the project with an optional argument for Express environment
grunt.registerTask('server', 'Runs the node.js app for this project', function () {
var done = this.async();
var args = '';
var useTrace = false;
process.env.HOST = '';
process.env.NODE_ENV = '';
for (var i = 0; i < this.args.length; i++) {
@cmcculloh
cmcculloh / cookiebot.js
Last active December 24, 2015 02:09 — forked from jeresig/cookiebot.js
CookieBot = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cook as fast as possible!
$("#bigCookie").click();
Game.cookiesPs=999999999999999;
}, 1);
this.buyInterval = setInterval(function(){
// Sometimes a golden cookie will appear to give you a bonus
// Click that too!
@cmcculloh
cmcculloh / gist:6689909
Created September 24, 2013 19:22
JS to CS translation utilities
#take an object definition and translate it's member function wrappers into coffee script
#
#eg:
# {
# blah: function(whatevs){
# var buncha = 'stuff here';
# }
# }
#
#becomes:
@cmcculloh
cmcculloh / app.js
Last active December 21, 2015 07:28
Referencing "the app" and venting with Marionettejs...
define(function (require) {
//require dependancies
var Marionette = require('backbone.marionette');
var Backbone = require('backbone');
var $ = require('jquery');
var _ = require('underscore');
// Override renderer to use pre-compiled templates
Marionette.Renderer.render = function (template, data) {
@cmcculloh
cmcculloh / migrate.sh
Created August 14, 2013 15:06
Migrate from one remote to another for a given repo
# replace <repo> with the name of the repository to be migrated
# replace <remote-from-url> with the url of the repository to be migrated from
# replace <remote-to-url> with the url of the repository to be migrated to
git init --bare temp<repo>
cd temp<repo>
git remote add from <remote-from-url>/<repo>.git
git remote add to <remote-to-url>/<repo>.git
git fetch from 'refs/*:refs/*'
git push to 'refs/*:refs/*'
@cmcculloh
cmcculloh / Gruntfile.js
Last active December 20, 2015 14:29
Sample of a typical requirejs single page nodeapp config
/*global module:false*/
/*
Allow grunt to utilize Git for build management
This is kind of like a miniature, built-in version of GitScripts https://github.com/cmcculloh/GitScripts
*/
var GitScripts = function(g){
var grunt = g;
return {
@cmcculloh
cmcculloh / SublimeText KeyBindings
Last active December 20, 2015 06:49
SublimeText KeyBindings
[
{
"keys": ["ctrl+alt+shift+f"], "command": "js_format",
"context": [{"key": "selector", "operator": "equal", "operand": "source.js,source.json"}]
}
]
@cmcculloh
cmcculloh / application-type.js
Last active December 13, 2015 19:18
Nearly finished Wizard Layout
define(function (require) {
var Marionette = require('backbone.marionette');
var $ = require('jquery');
var _ = require('underscore');
require('fuelux/all');
return Marionette.ItemView.extend({
template: require('tmpl!templates/wizard/appType.html'),
tagName:'div',
className: 'container',
@cmcculloh
cmcculloh / gist:3982834
Created October 30, 2012 20:34
Example of what I need for marionette triggers to be able to do
return Marionette.Layout.extend({
triggers: {
'click .editable': 'view:edit',
},
initialize: function(){
this.bindTo(this, 'view:edit', this.edit, this);
},
edit: function(ev){
@cmcculloh
cmcculloh / mybot.js
Created October 18, 2012 23:04 — forked from adamzr/mybot.js
My first node.js IRC bot
//
// My First IRC Bot
//
console.log("Bot Started...");
var irc = require('irc');
//For storing globals
var MYBOT = {};
//Channel to use