Skip to content

Instantly share code, notes, and snippets.

View zakgrant's full-sized avatar
🎯
Focusing

Zak Grant zakgrant

🎯
Focusing
View GitHub Profile
// Generated on 2014-12-15 using
// generator-webapp 0.5.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// If you want to recursively match all subfolders, use:
// 'test/spec/**/*.js'
@twilson63
twilson63 / csidoms.md
Created July 31, 2011 14:03
Common CoffeeScript Idoms - from the little book on CoffeeScript

Common CoffeeScript Idoms

Each

myfunction(item) for item in items

Map

@davidjrice
davidjrice / README.md
Created June 6, 2012 17:00
Vagrantfile for an Ubuntu lucid 32 or 64 bit VM with couchbase 2.0.0.dp4.1

Install Virtualbox

wget http://download.virtualbox.org/virtualbox/4.1.16/VirtualBox-4.1.16-78094-OSX.dmg
open VirtualBox-4.1.16-78094-OSX.dmg
# double click .pkg to install

Install vagrant

gem install vagrant --no-ri --no-rdoc
@balexand
balexand / xip_hack.rb
Created June 8, 2012 06:23
xip.io request hack
if Rails.env.development?
class XipIoMiddleware
def initialize(app)
@app = app
end
def call(env)
%w{HTTP_HOST SERVER_NAME SERVER_ADDR HTTP_X_FORWARDED_HOST}.each do |key|
env[key] = env[key].sub(/myapp\.\d+\.\d+\.\d+\.\d+\.xip\.io/, "myapp.dev") if env[key].present?
end
@dannyduc
dannyduc / gist:3694578
Created September 10, 2012 22:57
Maven Integration Test
<project>
<properties>
<jetty.port>8123</jetty.port>
</properties>
<build>
<plugins>
<plugin>
@hamstarr
hamstarr / tunnel.sh
Created October 17, 2012 12:31
tunnel.sh
#!/bin/sh
# tunnel.sh
# Configure
LOCAL_HOST=127.0.0.1;
USERNAME="your_username";
# set your remote address and SSH port.
TUNNEL_PORT="2022"
REMOTE_HOST="my.homedomainorip.com -p $TUNNEL_PORT";
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSWorkspace</key>
<key>SystemConfiguration</key>
<dict>
<key>State:/Network/Global/IPv4</key>
<dict>
<key>command</key>
@indec
indec / switch_audio.applescript
Last active December 17, 2015 21:09
An Applescript to cycle the audio input and output sources between two (or more) audio devices
on alfred_script(q)
set output_devices to {"Display Audio", "Generic USB Audio Device "}
set input_devices to {"Display Audio", "Generic USB Audio Device "}
set device_keywords to {"speakers", "headphones"}
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
tell application "System Events"
tell process "System Preferences"
@lillesand
lillesand / CsrfProtectionFilter.java
Last active December 19, 2015 07:19
Jersey sin Csrf protection
/**
*
* Også kan jeg kommentere her.
*
* Simple server-side request filter that implements CSRF protection as per the
* <a href="http://www.nsa.gov/ia/_files/support/guidelines_implementation_rest.pdf">Guidelines for Implementation of REST</a>
* by NSA (section IV.F) and
* section 4.3 of <a href="http://seclab.stanford.edu/websec/csrf/csrf.pdf">this paper</a>.
* If you add it to the request filters of your application, it will check for X-Requested-By header in each
* request except for those that don't change state (GET, OPTIONS, HEAD). If the header is not found,
@qingshan
qingshan / autosshd
Created January 7, 2012 02:43
autosshd is the autossh daemon.
#!/bin/bash
#
# autosshd This script starts and stops the autossh daemon
#
# chkconfig: 2345 95 15
# processname: autosshd
# description: autosshd is the autossh daemon.
# Source function library.
. /etc/rc.d/init.d/functions