Skip to content

Instantly share code, notes, and snippets.

View cyrille's full-sized avatar

Cyrille Stepanyk cyrille

  • Rapidonweb
  • Paris
View GitHub Profile
@cyrille
cyrille / zehnder
Last active January 1, 2016 04:48
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
#@sp = SerialPort.new("/dev/ttyUSB0", 9600, 8, 1, SerialPort::NONE)
@cyrille
cyrille / polygon_utilities.rb
Created July 23, 2011 07:27
Point in polygon (Gmap)
# encoding : utf-8
class Numeric
def to_rad
self.to_f / 180.0 * Math::PI
end
def to_deg
self.to_f * 180.0 / Math::PI
end
end
@cyrille
cyrille / Routes URLs
Created March 13, 2011 09:06
Rails one-liner to get URLs from rake routes
rake routes | sed -e "1d" -e "s,^[^/]*,,g" | awk '{print $1}' | uniq | sort
Source: http://trevmex.com/post/3822870892/rails-one-liner-to-get-urls-from-rake-routes