Skip to content

Instantly share code, notes, and snippets.

ADAPTER=sqlite3 spec spec/one_to_one_spec.rb
Profiling enabled.
...F....F....F........F.
Top 10 slowest examples:
0.0558030 Person.has(1, :profile); Person.accepts_nested_attributes_for(:profile, :allow_destroy => true) should allow to delete an existing profile via Person#profile_attributes
0.0469530 Person.has(1, :profile); Person.accepts_nested_attributes_for(:profile) should allow to update an existing profile via Person#profile_attributes
0.0460890 Person.has(1, :profile); Person.accepts_nested_attributes_for(:profile, :reject_if => lambda { |attrs| true }) should not allow to delete an existing profile via Person#profile_attributes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.postgresql.postgres</string>
<key>ProgramArguments</key>
<array>
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Whatever::Application
var responseMap = {};
responseMap["/"] = function (req, res) {
// if (req.method === "GET")
sys.puts("getting");
var body = JSON.stringify({blah: "blah"});
sys.puts(sys.inspect(body));
res.writeHead(200, { "Content-Type": "text/json", "Content-Length:": body.length});
res.end(body);
before :each do
@user = User.new(:email => '[email protected]')
@profile = Profile.new(:name => 'Ripple')
@billing = Address.new(:street => '123 Somewhere Dr', :kind => 'billing')
@shipping = Address.new(:street => '321 Anywhere Pl', :kind => 'shipping')
@friend1 = User.create(:email => "[email protected]")
@friend2 = User.create(:email => "[email protected]")
end
it "should save a many linked association" do
class Shop
class Warehouse
def self.find(id)
Product.find_by_id(id)
end
end
class Customer
attr_reader :user
<html>
<body>
<b>test</b>
</body>
</html>
@lancecarlson
lancecarlson / gist:5513834
Created May 3, 2013 20:33
example array of objects to JSON stream
var stream = JSONStream.stringifyObject()
stream.pipe(response)
_.pairs(myObject).map(function(current) { stream.write.apply(stream, current); })
stream.end()
function(doc, req) {
if (doc.type && doc.type == 'alert') {
return true;
}
return false;
}
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {