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 BankAccount < ActiveRecord::Base | |
include AttributeEncryption | |
belongs_to :billable, polymorphic: true | |
encrypted_attribute :encrypted_number, hash: true | |
validates :number, | |
format: { with: /[pP]?\d*/ } | |
# encrypted_attribute overrides #number= in order |
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
#include <AFMotor.h> | |
#include <Servo.h> | |
AF_DCMotor motorFrontLeft(3); | |
AF_DCMotor motorBackLeft(4); | |
AF_DCMotor motorFrontRight(2); | |
AF_DCMotor motorBackRight(1); | |
int servoPin = 10; | |
int pingPin = 15; |
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
/** | |
* RFID Ding 1.0 | |
* Copyright (C) 2012 Kabisa ICT | |
* Authors: | |
* Ralph Rooding <[email protected]> | |
* Harm de Laat <[email protected]> | |
* Ariejan de Vroom <[email protected]> | |
*/ |
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
int ledPins[] = {2,3,4,5,6,7,8,9}; | |
void setup(){ | |
for(int i = 0; i < 8; i++){ | |
pinMode(ledPins[i], OUTPUT); | |
} | |
} | |
void loop(){ | |
oneAfterAnotherNoLoop(); |
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
times in msec | |
clock self+sourced self: sourced script | |
clock elapsed: other lines | |
000.034 000.034: --- VIM STARTING --- | |
000.163 000.129: Allocated generic buffers | |
000.751 000.588: locale set | |
000.771 000.020: window checked |
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
# Helper class for importing files with records to the database. | |
class SeedFile | |
def self.import(path) | |
new(path).import | |
end | |
attr_reader :path | |
def initialize(path) | |
@path = Pathname(path) |
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 Batch | |
end | |
class Invoice < ActiveRecord::Base | |
belongs_to :invoicable, polymorphic: true | |
belongs_to :invoicer, polymorphic: true | |
has_many :invoice_lines | |
def amount |
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
1) Partnership as a relation between two people connects a person with a partner | |
Failure/Error: person = create(:person_parent, partner: partner) | |
ActiveRecord::RecordInvalid: | |
Validation failed: Person partnership cannot assign partner to a partner | |
# ./spec/models/partnership_spec.rb:13:in `block (3 levels) in <top (required)>' | |
2) Partnership as a relation between two people connects a partner with a customer_partner | |
Failure/Error: person = create(:person_parent, partner: partner) | |
ActiveRecord::RecordInvalid: | |
Validation failed: Person partnership cannot assign partner to a partner |
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
$ redis-benchmark ‹ruby-1.9.2› | |
====== PING (inline) ====== | |
10000 requests completed in 0.09 seconds | |
50 parallel clients | |
3 bytes payload | |
keep alive: 1 | |
100.00% <= 0 milliseconds | |
109890.11 requests per second |
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 MyApp | |
class Con < EM::Connection | |
def post_init | |
@queue = EM::Queue.new | |
end | |
def receive_data(data) | |
@queue.push(data) | |
end | |
end |