Skip to content

Instantly share code, notes, and snippets.

@nishantmodak
nishantmodak / nginx.conf.default
Last active February 29, 2024 13:48
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.
<Response>
<script/>
<Say voice="alice">Welcome call from TrustIQ.</Say>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
A - 🍎 - APPLE
B - 🏏 - BAT BALL
C - 😺 - CAT
D - 🐕 - DOG
E - 🐘 - ELEPHANT
F - 🐟 - FISH
G - 🐐 - GOAT
H - 🎩 - HAT
I - 🍦
J - 🃏
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails'
gem 'arel'
gem 'sqlite3'
gem 'minitest'
GEMFILE
system 'bundle'
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">]
@nishantmodak
nishantmodak / dino.rb
Last active December 18, 2015 18:00
Dino LED Blink
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
@nishantmodak
nishantmodak / rad.rb
Created June 20, 2013 11:21
Ruby Arduino Development Example Blink
class HelloWorld < ArduinoSketch
output_pin 13, :as => :led
def loop
blink led, 100
end
end
@nishantmodak
nishantmodak / serialport.rb
Created June 20, 2013 11:17
Serial Port Ruby
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
@nishantmodak
nishantmodak / blink.ino
Created June 20, 2013 11:14
Blink LED on 13