Skip to content

Instantly share code, notes, and snippets.


David Strauß stravid

View GitHub Profile
hoffmanc / en.yml
Last active Dec 20, 2015
Hand rolled ICS support
View en.yml
# locales/en.yml
ical: "%Y%m%dT%H%M%SZ"
maxhoffmann / gist:7373563
Last active Dec 27, 2015
run local php server and open browser
View gist:7373563
# local PHP Server
server() {
if [ -z "$1" ]; then
php -S $url & # run server in background
php -S $url -t $1 &
sleep 0.3s # wait for server to start
View gist:7463148
div.description a.autolink
display: inline-block;
max-width: 250px;
text-overflow: ellipsis;
overflow: hidden;
markbates /
Created Aug 31, 2011
Sprockets with a simple Rack app
require 'sprockets'
project_root = File.expand_path(File.dirname(__FILE__))
assets = do |env|
env.logger =
assets.append_path(File.join(project_root, 'app', 'assets'))
assets.append_path(File.join(project_root, 'app', 'assets', 'javascripts'))
assets.append_path(File.join(project_root, 'app', 'assets', 'stylesheets'))
View group_by_levenshtein.rb
emails = do |email|
grouping = emails
.group_by{|em| Levenshtein.distance(email, em) }
.select {|k,v| k < 5 && != 0 } # ignore exact matches and ones far off
if !grouping.empty?
[email, grouping]
searls / app.css
Created May 18, 2014
Handy trick for debugging to see which parts of your app are being re-rendering in the DOM (without keeping your eyes glued to web inspector)
View app.css
body * {
-webkit-animation: fade-in 2s ease-out;
animation: fade-in 2s ease-out;
madrobby /
Created Nov 14, 2011
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
reyjrar / New-iTerm-Window.scpt
Created Feb 8, 2012
AppleScript to Open a New iTerm Window and bring it to the front
View New-iTerm-Window.scpt
* New-iTerm-Window.scpt
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
* Based on much Googling - very little "original" code here
* Comments/Suggestions to
runemadsen / app.rb
Created Oct 17, 2012
Sinatra File Upload
View app.rb
require 'sinatra'
get "/" do
erb :form
post '/save_image' do
@filename = params[:file][:filename]
file = params[:file][:tempfile]
jeffreyiacono / Rakefile
Created Feb 8, 2012
rake task for precompiling assets using sprockets within a sinatra app + view helpers
View Rakefile
require 'rubygems'
require 'bundler'
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
You can’t perform that action at this time.