Skip to content

Instantly share code, notes, and snippets.

View sborsje's full-sized avatar
🤘

Stefan Borsje sborsje

🤘
  • Glass — Photography Community
  • Amsterdam, NL
  • X @sborsje
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sborsje on github.
  • I am sborsje (https://keybase.io/sborsje) on keybase.
  • I have a public key whose fingerprint is 3505 3A61 F5E7 4EEA 212F EE78 2309 BFB1 1693 161B

To claim this, I am signing this object:

@sborsje
sborsje / 10.04-LTS-EBS.json
Created August 22, 2012 21:54 — forked from ticean/10.04-LTS-EBS.json
CloudFormation Ubuntu AMI Mappings (Canonical)
"Mappings" : {
"AWSInstanceType2Arch" : {
"t1.micro" : { "Arch" : "64" },
"m1.small" : { "Arch" : "32" },
"m1.large" : { "Arch" : "64" },
"m1.xlarge" : { "Arch" : "64" },
"m2.xlarge" : { "Arch" : "64" },
"m2.2xlarge" : { "Arch" : "64" },
"m2.4xlarge" : { "Arch" : "64" },
"c1.medium" : { "Arch" : "32" },
@sborsje
sborsje / .bashrc
Created April 30, 2011 09:41
Switch projects
PROJECT_PARENT_DIRS[0]="$HOME/code"
for PARENT_DIR in ${PROJECT_PARENT_DIRS[@]} ; do
if [ -d "$PARENT_DIR" ]; then
for PROJECT_DIR in $(/bin/ls $PARENT_DIR); do
if [ ! -z `which $PROJECT_DIR` ]; then
continue # don't set alias if there is something already a command on the path with the same name
fi
if [ -d "$PARENT_DIR/$PROJECT_DIR" ]; then
alias "$PROJECT_DIR"="cd $PARENT_DIR/$PROJECT_DIR"
gemdoc() {
local gems=($(gem env gemdir)/doc/$1*/rdoc/index.html)
open ${gems[@]: -1}
}
complete -W '$(`which ls` $(gem env gemdir)/doc)' gemdoc
IPv4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255
REGEXP = %r{
\A
https?:// # http:// or https://
([^\s:@]+:[^\s:@]*@)? # optional username:pw@
( (xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)...
#{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4
(:\d{1,5})? # optional port
([/?]\S*)? # optional /whatever or ?whatever
\Z
function! DoPrettyXML()
" save the filetype so we can restore it later
let l:origft = &ft
set ft=
" delete the xml header if it exists. This will
" permit us to surround the document with fake tags
" without creating invalid xml.
1s/<?xml .*?>//e
" insert fake tags around the entire document.
" This will permit us to pretty-format excerpts of
@sborsje
sborsje / soap_responses.xml
Created January 9, 2010 01:49
Attempt to spec a handsoap service
<!-- AUTHORISE -->
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:authoriseResponse xmlns:ns1="http://payment.services.adyen.com">
<ns1:paymentResult>
<additionalData xmlns="http://payment.services.adyen.com" xsi:nil="true"/>
<authCode xmlns="http://payment.services.adyen.com">1234</authCode>
<dccAmount xmlns="http://payment.services.adyen.com" xsi:nil="true"/>
# Host based routing - enables routes like:
# map.connect '', :controller => 'blah', :action => 'blah', :conditions => {:host => 'blah'}
#
# Put this file in /config/initializers
module ActionController
module Routing
class Route
def recognition_conditions_with_host
result = recognition_conditions_without_host
#!/bin/sh
#
# Bash/AppleScript to automagically setup Rails development environment.
# This script opens a terminal windows, maximizes it and opens 4 tabs with:
# - autospec
# - tail -f development.log
# - script/console
# - mvim in the project folder
#
# Run this script with theproject path as argument, ea:
" Open ApiDock in a new Safari tab
let g:browser = 'open -a Safari '
" Open the Ruby ApiDock page for the word under cursor
function! OpenRubyDoc(keyword)
let url = 'http://apidock.com/ruby/'.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RB :call OpenRubyDoc(expand('<cword>'))<CR>