Skip to content

Instantly share code, notes, and snippets.

@localshred
localshred / rambling.txt
Last active August 29, 2015 14:11
India rambling for 20 minutes straight at bedtime 2014-12-17
So... we need... purple lights.... and... pink glitter... and pink purple lights... pink lights... and sparkle lights... and pink lights... and purple lights... and pink lights and purple lights and sparkle lights... and sparkle stars... and everything will be ALL done dad. You can put the balloons up. You and mommy can put my sparkle balloons up and my pink balloons up and my purple table. Just tangle them around and the thing will be all done. And i'll put some baby rainbows and you and mommy can put up pink and baby rainbows. And you can set up the mommy and daddy rainbows. And we can have, you and mommy can put up my balloons. K? And I can put up the baby balloons and you can setup the momma balloons, and the daddy balloons too. I'm gonna setup the baby rainbows. Bella's gonna setup my sparkle rainbows. And anders is gonna setup his very own sparkle rainbow. And I'm gonna Elsa capes I'm just doing so anybody won't cut 'em. And elsa's braids and anna's braids. K? I'm gonna setup the baby elsa braid and the
beach(Temperature) ->
case Temperature of
{celsius, N} when N >= 20, N =< 45 ->
'favorable';
{kelvin, N} when N >= 293, N =< 318 ->
'scientifically favorable';
{fahrenheit, N} when N >= 68, N =< 113 ->
'favorable in the US';
_ ->
'avoid beach'
@localshred
localshred / counts.json
Created July 21, 2014 17:46
jq is the bomb.com
{"results":[{"timePeriod":"201406100000","count":0},{"timePeriod":"201406110000","count":0},{"timePeriod":"201406120000","count":0},{"timePeriod":"201406130000","count":0},{"timePeriod":"201406140000","count":0},{"timePeriod":"201406150000","count":0},{"timePeriod":"201406160000","count":0},{"timePeriod":"201406170000","count":0},{"timePeriod":"201406180000","count":0},{"timePeriod":"201406190000","count":27},{"timePeriod":"201406200000","count":26},{"timePeriod":"201406210000","count":35},{"timePeriod":"201406220000","count":3},{"timePeriod":"201406230000","count":6},{"timePeriod":"201406240000","count":14},{"timePeriod":"201406250000","count":9},{"timePeriod":"201406260000","count":37},{"timePeriod":"201406270000","count":32},{"timePeriod":"201406280000","count":10},{"timePeriod":"201406290000","count":8},{"timePeriod":"201406300000","count":44},{"timePeriod":"201407010000","count":47},{"timePeriod":"201407020000","count":52},{"timePeriod":"201407030000","count":920},{"timePeriod":"201407040000","count":89}
@localshred
localshred / bundle_update.sh
Created September 27, 2013 17:15
Mavericks jruby 1.7.2 issues using jdk 7u40.
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://gems.moneydesktop.com/....
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://gems.moneydesktop.com/..
Resolving dependencies..........................................................................................................................................................................................................................................................................................................................................ManyVarsDynamicScope.java:147:in `setValueDepthZero': java.lang.ArrayIndexOutOfBoundsException: 0
from ManyVarsDynamicScope.java:140:in `setValue'
from NoVarsDynamicScope.java:87:in `setValue'
from LocalAsgnNode.java:123:in `interpret'
from BlockNode.java:71:in `interpret'
from RescueBodyNode.java:108:in `interpret'
@localshred
localshred / .gemrc
Created September 3, 2013 17:02
My gemrc
---
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org/
:update_sources: true
:verbose: true
gem: --no-rdoc --no-ri
:ssl_verify_mode: 0
@localshred
localshred / gtfs-realtime.pb.rb
Created March 19, 2013 21:14
Generated pb.rb files from zroger/protobuf-test after applying the fix from ruby-protobuf/protobuf#58.
##
# This file is auto-generated. DO NOT EDIT!
#
require 'protobuf/message'
module Transit_Realtime
##
# Message Classes
#
@localshred
localshred / .vimrc
Created March 13, 2013 03:10
My vimrc for the magics
"-------------------------------------------------------------------[Vundle]----
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'mileszs/ack.vim'
@localshred
localshred / better_cost_of_words.rb
Last active December 11, 2015 23:58
Because correcting 2nd grade homework can be tedious.
# This one is smaller with more ruby magic.
# I love you case statement.
words = %w( too two bargain treasure American America nearly advice advise newspaper
Christmas Christ length long strength strong popular interest destroy comparison
compare disaster beneath cocoa guard island cousin cabbage eager )
longest = words.inject(0) { |length, word| word.size > length ? word.size : length }
char_cost = lambda do |char|
@localshred
localshred / stackoverflow.sh
Created December 14, 2012 20:30
When I attempt to use JRuby in 1.7.0 I get a 2048K stack memory overflow.
% JRUBY_OPTS=-w gem install bundler Error: Your application used more stack memory than the safety cap of 2048K.
Specify -J-Xss####k to increase it (#### = cap size in KB).
Exception trace follows:
java.lang.StackOverflowError
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)
at java.io.File.isFile(File.java:778)
at org.jruby.runtime.load.LoadService.tryResourceAsIs(LoadService.java:1368)
at org.jruby.runtime.load.LoadService.tryResourceFromLoadPathOrURL(LoadService.java:1184)
at org.jruby.runtime.load.LoadService.findLibraryWithoutCWD(LoadService.java:1009)
@localshred
localshred / dynamic_methods.rb
Created October 18, 2012 20:37
I was wondering how fast the different dynamic method dispatching options in ruby are. After doing this, I guess I shouldn't be surprised. My assumption is that the method object call is slower since we're actually instantiating an object..
require 'benchmark'
class TestMethodCall
def test
100 + 100
end
end
Benchmark.benchmark("Dynamic method calling\n") do |x|
instance = TestMethodCall.new