Skip to content

Instantly share code, notes, and snippets.

View jonathanstiansen's full-sized avatar

Jonathan Stiansen jonathanstiansen

View GitHub Profile
const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
#!/bin/bash
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
# check if back merges are happening from important branches
echo "checking for bad branch names"
// Examples are: "tell application \"Google Chrome\" to return URL of front document"
// Other web app specific versions here: https://gist.github.com/vitorgalvao/5392178
let myAppleScript = "..."
var error: NSDictionary?
if let scriptObject = NSAppleScript(source: myAppleScript) {
if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) {
if let result = output.stringValue {
print(output.stringValue)
}
} else if (error != nil) {
@jonathanstiansen
jonathanstiansen / Profiling.swift
Created November 4, 2015 03:00 — forked from pyrtsa/Profiling.swift
Profile a block of code in Swift 2.0
import Foundation
public func profiling<R>(label: String, @noescape _ block: () -> R) -> R {
NSLog("*** %@...", label)
let start = NSDate()
defer {
let end = NSDate()
NSLog("*** %@ took %5.3g seconds", label, end.timeIntervalSinceDate(start))
}
return block()