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
# This is a cheap stab at demonstrating the behavior of | |
# Inotify::CREATE. That is, CREATE will trigger inotify events | |
# immediately upon file creation. | |
require 'inotify' | |
require 'fileutils' | |
# Method which fakes a slow write by sleeping for one second. | |
def slow_write(filename) | |
File.open(filename, "w") do |f| |
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
diff -ur marcbowes-UsingYAML-590c028/lib/using_yaml/array.rb UsingYAML-590c028/lib/using_yaml/array.rb | |
--- marcbowes-UsingYAML-590c028/lib/using_yaml/array.rb 2010-03-06 22:14:19.000000000 +0200 | |
+++ UsingYAML-590c028/lib/using_yaml/array.rb 2010-03-29 18:05:01.000000000 +0200 | |
@@ -25,5 +25,6 @@ | |
# Load in the extensions for this instance | |
array.extend(extensions) | |
+ array | |
end | |
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
$ cat Gemfile | |
source 'http://rubygems.org' | |
gem "rails", ">=3.0.5" | |
# To use debugger | |
# gem 'ruby-debug' | |
gem "guid" | |
gem "mysql2" |
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
# Explanation at http://stackoverflow.com/questions/5212213/ruby-equivalent-of-php-openssl-seal/9428217#9428217 | |
# Implementation | |
class EnvelopeEncryption | |
require "openssl" | |
# This method takes in plaintext and produces ciphertext and an |
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
module NameIdCache | |
def self.included(base) | |
m = Module.new | |
base.all.each do |record| | |
m.__send__(:define_method, record.name) do | |
record.record_id # using #record_id because OpenStruct is iffy about #id | |
end | |
end | |
base.extend(m) | |
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
module NameIdCache | |
def self.included(base) | |
m = Module.new | |
base.all.each do |record| | |
cache_key = NameIdCache.cache_key(base, record) | |
Rails.cache.write(cache_key, record.id) | |
m.__send__(:define_method, record.name) do | |
Rails.cache.fetch(cache_key) do |
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
Marc: Hi. I get this error on checkout: Transaction was declined by processor. | |
Sade: Hi Marc! | |
Sade: I will look into this | |
Sade: What is the order number? | |
Marc: I'm at checkout | |
Marc: 35246f7e5 | |
Marc: Earlier I tried via PayPal but that order was rejected too :-( | |
Sade: Hmm, I am seeing that it being rejected by us. | |
Sade: Is there anyway you can place the order when you get back to the states? | |
Marc: I don't live in the states |
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
require "digest/md5" | |
require "set" | |
found = Set.new | |
def md5sum(filename) | |
content = File.read(filename) | |
Digest::MD5.hexdigest(content) | |
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
git clone https://github.com/marcbowes/ember-hacking.git | |
bundle | |
rails s | |
open http://localhost:3000/ | |
Nothing appears in the console and I get the following error in the console | |
DEBUG: ------------------------------- ember.js?body=1 (line 339) | |
DEBUG: Ember.VERSION : 1.0.0-rc.1 ember.js?body=1 (line 339) |
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
DEBUG: ------------------------------- | |
DEBUG: Ember.VERSION : 1.0.0-rc.1 | |
DEBUG: Handlebars.VERSION : 1.0.0-rc.3 | |
DEBUG: jQuery.VERSION : 1.9.1 | |
DEBUG: ------------------------------- | |
TypeError: Application.registerInjection is not a function [Break On This Error] | |
injection: function(app, stateManager, property) { |
OlderNewer