Skip to content

Instantly share code, notes, and snippets.

/ HAML's syntax sucks for HTML5 data attrs when used as extensively
/ as they currently are by trendy JS frameworks.
#content{ :'data-role' => 'application' }
#header
ul.navigation{ :'data-role' => :toolbar }
li.navigation{ :'data-transition' => :fade } Link 1
li.navigation{ :'data-transition' => :bounce } Link 2
#main{ :'data-role' => :window }
Hello World
navlink:
data-transition: fade
sidebar:
data-role: sidebar
data-transition: slide
data-position: left
# ...
module Tournament
class BaseTournament < ActiveRecord::Base
end
class KOTHTournament < BaseTournament
include Bracket::KOTH
end
class SwissTournament < BaseTournament
include Bracket::Swiss
@logankoester
logankoester / approved.txt
Created July 21, 2011 20:04
Tournament Request Form - Thank you for submitting the Tournament Request Form. Please accept the license below.
Your Tournament Request has been approved. An approval email has been sent to you at test@test.com.
@logankoester
logankoester / simple_ar_benchmark.rb
Created August 17, 2011 20:18
Simple benchmarking for ActiveRecord Queries in rails console
# Give it two procs to compare
def bm(o, n); reload!; puts "Running 10 times"; Benchmark.bmbm(10) { |x| x.report('Old Query:') { @olr = o.call }; x.report('New Query:') { @nr = n.call } }; reload!; puts 'Old Result:' ; table(@olr); puts 'New Result'; table(@nr); end
@logankoester
logankoester / gist:1162499
Created August 22, 2011 14:27
git-rm any unsstaged deletions
git rm -f `git status | awk '/not staged/,0' | grep deleted | sed 's/# deleted: //'`
@logankoester
logankoester / nginx-excerpt.conf
Created August 22, 2011 21:24
An excerpt from my nginx reverse-proxy configuration
user logankoester logankoester;
worker_processes 2;
events {
worker_connections 2048;
}
http {
include mime.types;
default_type application/octet-stream;
@logankoester
logankoester / github_trending.js
Created August 28, 2011 07:08
Scraping trending respositories on Github with Node.js
@logankoester
logankoester / rails.vim
Created October 4, 2011 20:34
Useful Rails.vim macros
" Factories and Configuration
Rnavcommand config config -suffix=.yml -default=application
Rnavcommand factory spec/factories test/factories -suffix=.rb -default=model()
" Backbone
Rnavcommand bmodel app/assets/javascripts/backbone/models -suffix=.coffee -default=model()
Rnavcommand bview app/assets/javascripts/backbone/views -suffix=.coffee
" Apotomo Widgets (Cells)
Rnavcommand widget app/widgets -suffix=_widget.rb
@logankoester
logankoester / add_info_example.html
Created October 16, 2011 05:18
Add JSON info to a table using ICanHazJS to render an embedded Mustache template
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js"></script>
<script type="text/javascript">
var add_info = function(data){
var parsedData = $.map(data, function(item){
var keys = $.map(item, function(k, v){return({name: v})});
return({'keys': keys});
});