Add the following to your Gemfile:
gem 'heroku-api'
Put heroku.rb in your jobs folder and add the contents of heroku.html into your layout.
# To run git bisect looking for the first spec suite to exceed 1000MB of RAM: | |
# git bisect run ruby memory_usage.rb 'rake spec' 1000000 | |
require 'open3' | |
command = ARGV[0] | |
threshold = ARGV[1].to_i || 500000 | |
cmd = "/usr/bin/time -v #{command}" | |
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| |
Add the following to your Gemfile:
gem 'heroku-api'
Put heroku.rb in your jobs folder and add the contents of heroku.html into your layout.
#Rails Girls Things
Kuiper.Pusher = (opts = {}) -> | |
@init(opts) | |
this | |
$.extend Kuiper.Pusher.prototype, | |
options: {} | |
activeChannels: [] | |
init: (@options) -> | |
@pusher = new Pusher(@options.key) |
DS.Model.reopenClass | |
modelName: -> | |
model = this | |
parts = model.toString().split('.') | |
name = parts[parts.length - 1] | |
name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1) | |
getChannelPrefix: (callback) -> | |
@channelPrefix || $.get "/accounts/current.json", (data) -> | |
@channelPrefix = data['account']['pusher_channel'] |
... | |
def create | |
flash[:alert] = "You created a thing!" | |
redirect_to "/somepath" | |
end | |
... |
switchLabelClass = (el) -> | |
if $(el).attr("checked") == "checked" | |
$(el).parent().addClass("checked") | |
else | |
$(el).parent().removeClass("checked") | |
# Obviously change the form target here | |
checkbox_groups = $("form").find("input[type = 'checkbox']").each -> | |
$(this).hide() | |
switchLabelClass(this) |
require "celluloid/zmq" | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize(address) | |
@socket = PushSocket.new |
// Wrote this to try bruteforcing a hash key in part of the Stripe CTF game. | |
// I realise it would take something like 100 million years to find it, but I'd never written a hash generator before. | |
// Putting this on GitHub in case anyone's interested. | |
package main | |
import ( | |
"math/rand" | |
"strings" | |
"bytes" |
def ddg_info | |
@ddg_info ||= Rails.cache.fetch("places/#{id}-#{updated_at}/ddg_info", expires_in: 3.days) do | |
data = DDG.zeroClickInfo(name) | |
end | |
end |