This file contains 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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.3' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0' |
This file contains 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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails' | |
gem 'arel' | |
gem 'sqlite3' | |
gem 'minitest' | |
GEMFILE | |
system 'bundle' |
This file contains 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.9.3p362 :001 > Line.cached_foreign(1) | |
Line Load (1.1ms) SELECT "lines".* FROM "lines" WHERE "lines"."foreign_id" = 1 | |
=> [#<Line id: 1, no: 1, foreign_id: 1, created_at: "2012-09-28 09:18:14", updated_at: "2012-09-28 09:18:14">, #<Line id: 3, no: 3, foreign_id: 2, created_at: "2012-09-28 09:25:41", updated_at: "2012-09-28 09:25:41">, #<Line id: 4, no: 4, foreign_id: 2, created_at: "2012-09-28 09:26:00", updated_at: "2012-09-28 09:26:00">] | |
1.9.3p362 :002 > Line.cached_foreign(1) | |
Line Load (1.6ms) SELECT "lines".* FROM "lines" WHERE "lines"."foreign_id" = 1 | |
=> [#<Line id: 1, no: 1, foreign_id: 1, created_at: "2012-09-28 09:18:14", updated_at: "2012-09-28 09:18:14">, #<Line id: 3, no: 3, foreign_id: 2, created_at: "2012-09-28 09:25:41", updated_at: "2012-09-28 09:25:41">, #<Line id: 4, no: 4, foreign_id: 2, created_at: "2012-09-28 09:26:00", updated_at: "2012-09-28 09:26:00">] |
This file contains 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 'dino' | |
board=Dino::Board.new(Dino::TxRx::Serial.new) | |
led = Dino::Components::Led.new(pin: 13, board: board) | |
[:on, :off].cycle do |switch| | |
led.send(switch) | |
sleep 1 | |
end |
This file contains 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 HelloWorld < ArduinoSketch | |
output_pin 13, :as => :led | |
def loop | |
blink led, 100 | |
end | |
end | |
This file contains 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 "serialport" | |
#params for serial port | |
port_str = "/dev/ttyUSB0" #may be different for you | |
baud_rate = 9600 | |
data_bits = 8 | |
stop_bits = 1 | |
parity = SerialPort::NONE |
This file contains 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 led = 13; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(led, OUTPUT); | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { |
This file contains 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 <IRremote.h> | |
int RECV_PIN = 11; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
int i = 0; | |
int blinkarray[11]; | |
int user=0; | |
void setup() | |
{ | |
for(i=2;i<11;i++) |
NewerOlder