This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pow_proxy' | |
run PowProxy.new(:host => '127.0.0.1', :port => 3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// change this REGEXP to whatever you need | |
var PATTERN = /<title>(.*)<\/title>/g; | |
var message = '', | |
results = document.documentElement.innerHTML.match(PATTERN); | |
message = ((results && results.length) ? results.join('\n') : 'Not found.'); | |
window.alert(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(35deg, #f06, yellow); | |
min-height:100%; | |
text-shadow: 4px 4px rgba(0,0,0,0.25); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CScott CSS/mobile logo | |
*/ | |
html { | |
font-family: 'Source Sans Pro', Arial, sans-serif; | |
background: url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/noisy_grid.png'); | |
} | |
#logo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name) { | |
this.name = name; | |
} | |
Person.prototype.speak = function () { | |
console.log(this.name); | |
}; | |
function Employee(name) { |
OlderNewer