Skip to content

Instantly share code, notes, and snippets.

View cucumber_external_resque_worker.rb
class CucumberExternalResqueWorker
DEFAULT_STARTUP_TIMEOUT = 1.minute
COUNTER_KEY = "cucumber:counter"
class << self
attr_accessor :pid, :startup_timeout
def start
# Call from a Cucumber support file so it is run on startup
return unless Rails.env.cucumber?
@avinasha
avinasha / about.md
Created Aug 16, 2011 — forked from blaix/about.md
Programming Achievements: How to Level Up as a Developer
View about.md

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

View django.md

If you dont have a python env setup yet, follow the instructions in python_env.md.

Installing django

Setting up django for a new project

Installing django

Once your python env is setup: pip install Django==1.8.2

Create a new porject

django-admin.py startproject <name> This creates the following file structure

@avinasha
avinasha / soulmate.rb
Last active Aug 29, 2015
Soulmate Loader
View soulmate.rb
require 'soulmate'
module Soulmate
class Loader < Base
def load_without_reset(items)
items.each_with_index do |item, i|
puts item["id"]
add(item, :skip_duplicate_check => true)
end
end
View trace
1 static.33.170.9.5.clients.your-server.de (5.9.170.33) 3.140 ms 3.237 ms 3.234 ms
2 hos-tr3.juniper2.rz16.hetzner.de (213.239.223.193) 0.148 ms hos-tr1.juniper1.rz16.hetzner.de (213.239.222.65) 0.154 ms 0.152 ms
3 core21.hetzner.de (213.239.245.93) 0.247 ms core22.hetzner.de (213.239.245.133) 0.252 ms 0.242 ms
4 core11.hetzner.de (213.239.245.221) 2.783 ms core12.hetzner.de (213.239.245.29) 2.768 ms core11.hetzner.de (213.239.245.221) 2.777 ms
5 juniper4.rz2.hetzner.de (213.239.245.26) 2.817 ms 2.853 ms 2.796 ms
6 r1nue1.core.init7.net (77.109.135.101) 10.427 ms 6.478 ms 6.969 ms
7 r1lon1.core.init7.net (77.109.140.253) 22.656 ms 22.620 ms 22.612 ms
8 * * *
9 * * *
10 * * *
View song_to_hue.rb
require 'hue'
require 'waveform'
audio = RubyAudio::Sound.open(source)
length = audio.info.length.to_i
frames = audio.info.frames
sample_period = 1
frames_per_sample = frames / sample_period