Skip to content

Instantly share code, notes, and snippets.

Geoffrey Grosenbach topfunky

Block or report user

Report or block topfunky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@topfunky
topfunky / troubleshooting.md
Created Oct 10, 2012
Troubleshooting chef-solo
View troubleshooting.md

Troubleshooting chef-solo

Re: PeepCode screencast on Meet Chef

  • Is the VM running? Try vagrant up
  • Can you connect to the VM? Try vagrant ssh
  • Did chef-solo -j /etc/chef/node.json run without error?
  • Did chef-solo install the nginx package? You should see Run List is [recipe[nginx]]
  • Is Nginx running on the VM? Try ps aux | grep nginx
  • Does the webserver respond on the VM? Run curl -I http://localhost from inside the VM. You should see Server: nginx in the output.
@topfunky
topfunky / duplicate-finder-window.applescript
Created Aug 24, 2012
Make a new Finder window open to the same directory as the current one.
View duplicate-finder-window.applescript
(*
Duplicate current Finder window
Author: Barry Els
Version: 1.1
*)
try
tell application "Finder"
set this_folder to (the target of the front window) as alias
@topfunky
topfunky / CHANGES.md
Created Aug 2, 2012
Express 3.0 Changes
View CHANGES.md

Changes in Express 3.0 Templates

Related: PeepCode Full Stack Node.js screencast (an included code sample works with Express 3.0).

There are several syntax changes in Express 3.0. They do require modifications to your code, but they aren't too complicated.

The biggest change is that Express templates now use Django style inheritance rather than ERB/Rails style automatic layouts.

Summary

@topfunky
topfunky / instanceof-example.js
Created Mar 22, 2012
example of using instanceof
View instanceof-example.js
// NOTE: `app` parameter is an instance of Express.js.
module.exports = function(app) {
var socketIO;
socketIO = require('socket.io').listen(app);
socketIO.sockets.on('connection', function(socket) {
console.log("CONNECTED");
console.log(socket instanceof socket.constructor);
});
};
View knights-tour-test.coffee
vows = require 'vows'
assert = require 'assert'
class Board
class Tour
constructor: ->
@board = new Board
suite = vows.describe('KnightsTour')
@topfunky
topfunky / Cakefile
Created Feb 11, 2012
Run tasks sequentially in a Cakefile
View Cakefile
task 'sample_task', sample_task = (callback) ->
doSomethingAndRunCallbackAfter callback
task 'setup', 'All: Import all data and run webserver', ->
tasks = [install, pre_populate, populate_couch, graph_sync, server]
runSequentially = (currentTask, otherTasks...) ->
currentTask ->
if otherTasks.length
runSequentially otherTasks...
runSequentially tasks...
@topfunky
topfunky / duration.coffee
Created Aug 31, 2011
A custom Batman.js filter
View duration.coffee
# Transform an integer number of seconds as hours and minutes: 1:45
#
# Put in filters/duration.coffee and do @require('filters', 'duration')
Batman.Filters.formatSecondsAsTime = (value) ->
seconds = parseInt value, 10
return '' unless seconds
hours = parseInt seconds / 60 / 60, 10
minutes = parseInt (seconds / 60) % 60, 10
hours = '' unless hours > 0
minutes = '0' + minutes if minutes < 10
@topfunky
topfunky / jammit_sass_support.rb
Created Aug 6, 2011 — forked from mitio/jammit_sass_support.rb
SASS support for Jammit in development mode (also with proper plugins support, for e.g. Compass)
View jammit_sass_support.rb
# Much simpler, less work. Handles everything SASS can.
require 'haml/util'
require 'sass/engine'
module Jammit
module Helper
SASS_TIMESTAMPS = {}
def include_stylesheets_with_sass(*packages)
@topfunky
topfunky / new-github.sh
Created Jul 25, 2011
Shell shortcut to setup a Git repo with GitHub. Works with zsh or bash.
View new-github.sh
# Usage: new-github topfunky tidy_table
function new-github() {
git remote add origin git@github.com:$1/$2.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
@topfunky
topfunky / new-git.sh
Created Jun 9, 2011
Create a new git repository on a remote server. Assumes that you're sitting in an initialized Git repo.
View new-git.sh
function new-git () {
ssh git@example.com "mkdir $1.git && cd $1.git && git --bare init"
git remote add origin git@example.com:$1.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
You can’t perform that action at this time.