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 'rubygems' | |
# Gem.use_paths(nil, Gem.paths + [...]) | |
require 'wirble' | |
require 'bond' | |
Wirble.init | |
Wirble.colorize | |
Bond.start | |
# other gems might include: 'ap' 'map_by_method' |
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 'curb' | |
class Test::Unit::TestCase | |
def run(result) | |
## CALL TO REMOTE ### | |
require 'ruby-debug' | |
debugger | |
Curl::Easy.http_post('apigen.info') {|g| true } | |
puts 'do stuff' | |
##### |
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 'rubygems' | |
# options available by superclassing. See defs/examples below. | |
class MDS | |
class << self | |
def shalphadecimal(number) | |
case number | |
when String | |
require 'digest' | |
shalphadecimal( Digest::MD5.new << number ).rjust(20,"0") |
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 coefs_to_parabola(*coefs) | |
proc, order = coefs.inject([lambda{|x|x},0]) do |(proc,order),coef| | |
[ | |
Proc.new {|x| coef * x**order + proc.call(x) }, | |
order += 1 | |
] | |
end | |
proc | |
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
As an anonymous user | |
I want to search to apicomparison.com | |
So that I can see what steps are necessary to do cross-site API | |
Scenario 1 - Add new framework is a select drop-down with event observer | |
Given | |
I am on the home page | |
When | |
I fill "framework_1" select with "Add new framework" | |
Then |
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
# in the console ... | |
def try_to_fail(p) | |
begin | |
MyModel.transaction do | |
p.name = "Eustace" | |
p.save | |
5+5 | |
raise Exception | |
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
## words/word.py | |
import pdb | |
import scriptutil as SU | |
import re | |
import psycopg2 | |
from psycopg2.extras import DictCursor | |
from psycopg2.extensions import adapt |
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
## words/word.py | |
import scriptutil as SU | |
import re | |
import psycopg2 | |
from psycopg2.extras import DictCursor | |
from psycopg2.extensions import adapt | |
try: | |
db = psycopg2.connect(database="scrabble", user="python", password="python") |
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
I am mapping devices. Led is a light emitting diode. BluetoothDetector is a modular microcontroller that holds the logic and is | |
I have an ARobject BluetoothDetector which inherits (but is NOT STI) from ArduinoBt. | |
p = BluetoothDetector.first; p | |
=> #<BluetoothDetector id: 1, name: "the main controller device"> | |
>> p.children << BluetoothDetector.create(:name=>'slave device') | |
=> [#<BluetoothDetector id: 45, name: "slave device">] | |
>> DeviceConnection.first |
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 AddElectricOpToVehicleModels < ActiveRecord::Migration | |
def self.up | |
test = VehicleModel.find(:first) | |
if test.attributes["electric_percent"] != nil | |
down | |
end | |
add_column :vehicle_models, :electric_percent, :float, :default => 0 |