Skip to content

Instantly share code, notes, and snippets.

View jsteiner's full-sized avatar

Josh Steiner jsteiner

View GitHub Profile
dependencies:
cache_directories:
- "~/.stack"
pre:
- wget https://github.com/commercialhaskell/stack/releases/download/v0.1.6.0/stack-0.1.6.0-linux-x86_64.tar.gz -O /tmp/stack.tar.gz
- tar xvzOf /tmp/stack.tar.gz stack-0.1.6.0-linux-x86_64/stack > /tmp/stack
- chmod +x /tmp/stack && sudo mv /tmp/stack /usr/bin/stack
override:
- stack setup
- stack build --dependencies-only --test
@wvengen
wvengen / README.md
Last active March 25, 2024 07:53
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

@evancz
evancz / History.elm
Last active November 23, 2015 20:44
module History where
type History state value =
{ state | undo : History s a -> Maybe (History s a)
, redo : History s a -> Maybe (History s a)
, add : a -> History s a -> History s a
, value : History s a -> Maybe a
}
type Infinite a = { past : [a], future : [a] }
@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});
@plapier
plapier / js2coffeescript.rb
Last active December 14, 2015 02:59
Convert Javascript to CoffeeScript (vice versa) directly from vim. Uses js2coffee library.
#!/usr/bin/env ruby
require 'tempfile'
file = Tempfile.new(['js2coffee', '.js'])
file.write ARGF.read # write vim selection to tmp file
file.rewind
file.close
puts `js2coffee #{file.path}` # requires js2coffee
file.unlink # deletes the temp file
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session