Skip to content

Instantly share code, notes, and snippets.

View deedubs's full-sized avatar
:shipit:
kustomize build all-the-things | kubectl apply -f -

Dan Williams deedubs

:shipit:
kustomize build all-the-things | kubectl apply -f -
View GitHub Profile
@deedubs
deedubs / user.coffee
Created April 19, 2011 15:39
A snippet from mongoose user def
...
# Define the schema for the user
schema = new db.Schema
name :
first_name : String
last_name : String
location : String
created_at :
type : Date
default : Date.now
task :restart, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && sudo kill -SIGUSR2 `cat tmp/pids/master.pid`"
end
@deedubs
deedubs / plugin.js
Created April 28, 2011 17:17
Simple plugin to link up mentioned Epic.IO mission Ids in your talkerapp chat
plugin.onMessageInsertion = function(event){
if(event.content.match(/!\w{2}\d{4,}/)) {
var last_message = Talker.getLastRow();
var contents = last_message.html();
var newContents = contents.replace(/!(\w{2}\d{4,})/g,'<a style="font-weight: bold;border-bottom: 1px solid #F15c50" href="http://epic.io/$1">!$1</a>');
last_message.html(newContents);
}
}
var News = db.model('News');
app.get('/dashboard', function (req, res, next) {
req.user.getLikes(function(err, likes){
if (err) return next(err);
News.getLatest(function(err, news){
if (err) return next(err);
res.render('dashboard', { likes: likes, latestNews: news });
});
});
});
@deedubs
deedubs / filter-chains.coffee
Created May 11, 2011 19:57
long filter chains
server.get '/', app.helpers.loadUser, helpers.loadAccounts, helpers.loadExpenses, helpers.loadCategories, controllers.expenses.index
...
controllers.expenses =
index : (req, res) ->
res.render 'index'
categories : req.categories
expenses : req.expenses
user : req.user
accounts : req.accounts
@deedubs
deedubs / express-mongoose.coffee
Created May 11, 2011 20:02
using express-mongoose
server.get '/', controllers.expenses.index
...
controllers.expenses =
index : (req, res) ->
res.render 'index'
user : req.user
categories : req.user.getCategories()
expenses : req.user.getExpenses()
accounts : req.user.getAccounts()
@deedubs
deedubs / gist:993293
Created May 26, 2011 14:44
Google xml -> xml2js vs Google JSON
The JSON google sends you with ?alt=json
folderJSON['gd$resourceId']['$t']
Taking the default XML from google through xml2js
folderJSON['gd:resourceId']
@deedubs
deedubs / async.coffee
Created May 29, 2011 13:27
Using coffeescript vowsjs for Async tests
vows = require 'vows'
assert = require 'assert'
cb = (callback) ->
setTimeout ->
callback(null, 'callback')
, 2000
andWaitForCallback = undefined
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at Master.<anonymous> (/root/epic.io/node_modules/cluster/lib/master.js:226:13)
at Master.call (/root/epic.io/node_modules/cluster/lib/worker.js:73:17)
at HTTPServer.<anonymous> (/root/epic.io/node_modules/cluster/lib/plugins/stats.js:62:18)
at HTTPServer.emit (events.js:81:20)
at IOWatcher.callback (net.js:948:12)
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
@deedubs
deedubs / gist:1162411
Created August 22, 2011 13:51
Github Error on Pull
git pull
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 22 (delta 12), reused 21 (delta 11)
Unpacking objects: 100% (22/22), done.
/data/github/current/lib/github/config/failbot.rb:5: undefined method `setup' for Failbot:Module (NoMethodError)
from /data/github/current/config/basic.rb:168:in `require'
from /data/github/current/config/basic.rb:168
from hooks/post-upload-pack:5:in `require'
from hooks/post-upload-pack:5