This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestState | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
state_machine :state, initial: :authorized do | |
event :capture_money do | |
transition :authorized => :captured | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_events_for_song_change(user, old_song, new_song) | |
timenow = Time.now.to_i | |
EventSender.send_user_played_song(user, old_song, timenow) | |
EventSender.send_user_started_playing_song(user, new_song, timenow) | |
end | |
playlist.started_at = Time.now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORIG_ARTIST = "Jichael Mackson" | |
Media.where(:artist => ORIG_ARTIST).each(&:destroy) | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
require 'factory_girl' | |
begin | |
FactoryGirl.define do | |
factory :media do | |
comment "dummy_foo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": "_design/num_ar_id", | |
"_rev": "36-145879462ded07757a29757bb5b5b92b", | |
"language": "javascript", | |
"views": { | |
"count_of_ar_id": { | |
"map": "function(doc) {\n if (doc.ar_id) {\n emit(doc.ad_id, doc.ar_id );\n }\n}", | |
"reduce": "function(keys, values, rereduce) {\n if (rereduce) {\n return sum(values);\n }\n else {\n return values.length;\n }\n}" | |
}, | |
"count_of_ar_id_impl": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dir_scan(src, files = []) | |
Dir.foreach(src) do |e| | |
# Don't bother with . and .. | |
next if [".",".."].include? e | |
fullname = src + "/" + e | |
if FileTest::directory?(fullname) | |
files = dir_scan(fullname, files) | |
else | |
if (e.match("(.)m4a") || e.match("(.)aac") || e.match("(.)mp3")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assertion failed: (_Unwind_SjLj_Resume() can't return), function _Unwind_SjLj_Resume, file /SourceCache/libunwind/libunwind-24.1/src/Unwind-sjlj.c, line 326. | |
Program received signal: “SIGABRT”. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void logKeysOfDictName(NSDictionary *dict, NSString *dictName) { | |
for (id key in dict) { | |
NSLog(@">>>> [%@] key - loaded %@", key, dictName); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
consumer_secret = <<END_OF_STRING | |
-----BEGIN PUBLIC KEY----- | |
KEY HERE HERE | |
-----END PUBLIC KEY----- | |
END_OF_STRING | |
request_proxy = OAuth::RequestProxy::ActionControllerRequest.new(request) | |
signature_base_string = request_proxy.signature_base_string | |
public_key = OpenSSL::PKey::RSA.new(consumer_secret).public_key | |
logger.error "public_key returned: #{public_key} " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = User.all[100..120] | |
root_url = "www.wahwah.fm" | |
current_user = User.find(150) | |
jsonstring = "[#{user.collect { |u| | |
listenerhash = {:listenercount => u.listeners.count} | |
u.listeners.around_me(point1, point2).each_with_index do |listener, i| | |
listenerhash.merge!({i => {:name => listener.name}}) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Mon, 27 Sep 2010 16:17:39 +0200] DEBUG: Headers in authenticate_every: {:x_ops_authorization_6=>"imC54SWH3uOoFINFX4X6ebe7XSz66cKKZ5/ZmGfKzw==", :x_ops_timestamp=>"2010-09-27T13:25:29Z", :x_ops_authorization_1=>"p+z+A97hGnHHkVbSF+/JZg53mKJL9PXD0Y6IH5wOgOxPekPqppV6U74xNL31", :x_ops_authorization_2=>"ltMeizl/NfQk33hJB8Vvm9sQQpp8dtwCei151eREuUD2p5xVGFiopegAnC2E", :x_ops_content_hash=>"ZtrGElA6L96p3Pf8nQLZsbOPE7s=", :x_ops_authorization_3=>"zVHJSXEMH8OuXxdumq3NIJ3Anh5yCgsICj/NFWJ9SiJr5eQ2A0/gVnA3AS2k", :x_ops_sign=>"version=1.0", :connection=>"close", :version=>"HTTP/1.1", :x_ops_userid=>"chef-validator", :accept=>"application/json", :x_ops_authorization_4=>"LVmp4lXeQLYNOSEPCr4bqDGMW/eGgHaSZLZh+ifKE19HVwNw2f08Uf/Hpc5E", :host=>"centos-chef.wahwah.local:4000", :x_ops_authorization_5=>"g4ZRHXeRZoWeYUTUoDFnr/JJzk9ZFYw7CKms1rOR5NmYu7MXRW6TcJjMkFMf", :x_chef_version=>"0.8.16"} | |
[Mon, 27 Sep 2010 16:17:39 +0200] INFO: Authenticating client chef-validator | |
[Mon, 27 Sep 2010 16:17:39 +0200] DEBUG: Sending HTTP Request via |