Skip to content

Instantly share code, notes, and snippets.

Logan Koester logankoester

Block or report user

Report or block logankoester

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@logankoester
logankoester / simple_ar_benchmark.rb
Created Aug 17, 2011
Simple benchmarking for ActiveRecord Queries in rails console
View simple_ar_benchmark.rb
# 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 / Gemfile
Last active Dec 25, 2015
Serving static nanoc output with Unicorn instead of WEBrick for faster development.
View Gemfile
source 'https://rubygems.org'
gem 'unicorn'
gem 'rack'
gem 'rack-rewrite'
@logankoester
logankoester / precompute.underscore.coffee
Created Sep 29, 2013
Recursively map any functions to their returned value. This function will modify the passed object.
View precompute.underscore.coffee
# Recursively map any functions to their returned value.
# This function will modify the passed object.
_.mixin
precompute: (object) ->
functions = @functions object
try
keys = @keys object
objects = @filter keys, (key) =>
@isObject(object[key])
catch
@logankoester
logankoester / Gruntfile.coffee
Created Jul 31, 2013
Splitting an overgrown Gruntfile into multiple files
View Gruntfile.coffee
#global module:false
module.exports = (grunt) ->
# Inject project configuration from files
gruntConfigDir = __dirname + '/grunt/'
require('fs-walk').walkSync gruntConfigDir, (baseDir, filename, stat) ->
if match = filename.match(/^(.*)\.coffee$/)
grunt.config.set(match[1], require(baseDir + filename)(grunt))
, (err) -> if err then console.log(err)
View tmux.conf
# This configuration should feel familiar to screen & vi users.
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
View tmux.conf
# This configuration should feel familiar to screen & vi users.
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
@logankoester
logankoester / adb-record.sh
Last active Oct 14, 2015
Record, merge, and accelerate Android screen capture
View adb-record.sh
#!/usr/bin/env bash
# Repeatedly records Android screen capture to files 180 seconds in length
# until Ctrl+C, then pulls those files to the desktop, merges them into
# one video, generates an additional 8x speed version (*-8x.mp4) and cleans
# up the intermediary files.
# Depends on: ffmpeg, adb
# Usage: $ adb-record <name> # => ./name.mp4
View hydra spinner 23x16
<style>
#facebookG{
width:23px}
.facebook_blockG{
background-color:#F27521;
border:1px solid #D8D8D9;
float:left;
height:16px;
margin-left:1px;
View wizard-island.md

Wizard Island 2012

We will be camping Friday and Saturday night at sites 87 & 88 on Lake George's Long Island, one of the southernmost islands 4.41 miles by kayak from the Village.

Date Friday September 21st - Sunday September 22nd

Cost $98/person

Limit 8 wizards

@logankoester
logankoester / sandboxed_ads.html
Created Jun 14, 2012
Sandboxing 3rd-party ad code
View sandboxed_ads.html
<html>
<head>
<script type="text/javascript" src="//caja.appspot.com/caja.js"></script>
<script type="text/javascript">
caja.initialize({ cajaServer: 'https://caja.appspot.com/', debug: true });
// Force all network requests to use HTTPS.
// Prevents Insecure Content errors when the host page was loaded securely.
var uriPolicy = {
rewrite: function(uri) { return( uri.replace(/^http:/, 'https:') ); }
You can’t perform that action at this time.