Skip to content

Instantly share code, notes, and snippets.

View christopherscott's full-sized avatar
👍
asdf

Christopher Scott Hernandez christopherscott

👍
asdf
View GitHub Profile
@christopherscott
christopherscott / wysiwym-jquery-setup
Created June 21, 2012 15:33
setting up wysiwym jquery plugin
// setup wysiwym
$(function() {
$("#post-body textarea").wysiwym(Wysiwym.Markdown, {});
// setup live preview
var showdown = new Showdown.converter();
var prev_text = "";
var update_live_preview = function() {
var input_text = $("#post-body textarea").val();
@christopherscott
christopherscott / pow-proxy-config-ru
Created June 21, 2012 15:29
Config.ru required for pow_proxy
require 'pow_proxy'
run PowProxy.new(:host => '127.0.0.1', :port => 3000)
@christopherscott
christopherscott / mongodb-cakefile.coffee
Created June 2, 2012 01:22
MongoDB start/stop Cakefile
{exec} = require 'child_process'
task "db:start", "start mongo db daemon process", ->
exec "mongod --fork --logpath ~/mongodb.log --logappend"
console.log "mongodb started"
task "db:stop", "stop mongo daemon process", ->
exec "kill -2 `ps -ef | grep 'mongod --fork' | grep -v grep | awk '{ print $2 }'`"
console.log "mongodb should be stopped"
@christopherscott
christopherscott / ExcelToJsDate.js
Created May 24, 2012 16:40
Convert Excel date values to JavaScript date objects
// Convert Excel dates into JS date objects
//
// @param excelDate {Number}
// @return {Date}
function getJsDateFromExcel(excelDate) {
// JavaScript dates can be constructed by passing milliseconds
// since the Unix epoch (January 1, 1970) example: new Date(12312512312);
@christopherscott
christopherscott / gist:1705508
Created January 30, 2012 17:17
super clean, basic api testing with node.js, vows, and coffeescript
vows
.describe("Main sections should respond with 200 ok:")
.addBatch
"get /": respondsWith 200
"get /blog": respondsWith 200
"get /portfolio": respondsWith 200
"get /about": respondsWith 200
"get /contact": respondsWith 200
.export(module)
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}