I'm running netty, so jzmq + 0mq are not guaranteed to work.
brew install zeromq
DO | |
$$ | |
DECLARE | |
s name; | |
t name; | |
rowc bigint; | |
BEGIN | |
FOR s, t IN select table_schema, table_name | |
from information_schema.tables |
# Example of using callbacks with Python | |
# | |
# To run this code | |
# 1. Copy the content into a file called `callback.py` | |
# 2. Open Terminal and type: `python /path/to/callback.py` | |
# 3. Enter | |
def add(numbers, callback): | |
results = [] | |
for i in numbers: |
require 'digest/sha1' | |
class Invite < ActiveRecord::Base | |
validates_presence_of :email, :on => :save, :message => "can't be blank" | |
validates_uniqueness_of :email, :on => :save, :message => "is already registered" | |
named_scope :unsent_invitations, :conditions => {:redeemed_at => nil, :invite_code => nil} | |
def invited? |
require 'benchmark/ips' | |
class SelfRuby | |
attr_accessor :foo | |
def initialize | |
self.foo = 1 | |
end | |
end | |
# SLOWEST! |
require 'hashie' | |
require 'ostruct' | |
require 'benchmark/ips' | |
class PORO | |
attr_reader :foo, :bar, :baz | |
def initialize attrs = {} | |
attrs.each do |attr, value| | |
instance_variable_set "@#{attr}", value |
require 'benchmark/ips' | |
class A | |
def test | |
10.times do | |
yield | |
end | |
end | |
end |
(byebug) hello = instance_double("Planet") | |
#<InstanceDouble(Planet) (anonymous)> | |
# Using RSpec block syntax to specific a return value. | |
(byebug) allow(hello).to receive(:world) { "hello, world" } | |
#<RSpec::Mocks::VerifyingMessageExpectation #<InstanceDouble(Planet) (anonymous)>.world(any arguments)> |
// Example lifted from https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | |
// | |
// Example 6: Compute Timestamp from current time in Ruby | |
// | |
// [1] pry(main)> now = Time.now | |
// => 2016-05-20 00:33:04 -0700 | |
// [2] pry(main)> seconds = now.to_i | |
// => 1463729584 | |
// [3] pry(main)> nanos = now.nsec | |
// => 204053000 |
require "io/console" | |
require "socket" | |
require "net/http" | |
require "uri" | |
require 'cgi' | |
SSDP_ADDR = "239.255.255.250"; | |
SSDP_PORT = 1900; | |
SSDP_ST = "roku:ecp"; |