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
extern crate serial; | |
use std::path::Path; | |
use std::path::PathBuf; | |
use serial::prelude::*; | |
use serial::posix::TTYPort; | |
struct FirmataBoard { | |
port: TTYPort, |
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
use std::fmt::Show; | |
use std::fmt::Formatter; | |
use std::fmt::FormatError; | |
enum Tree<T> { | |
Node(T, Box<Tree<T>>, Box<Tree<T>>), | |
Nil, | |
} | |
impl<T: Ord + Show> Tree<T> { |
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
{ | |
"links": [ | |
"foos.images.url": "https://some-s3-bucket/foo/bar/{images_id}" | |
], | |
"foos": [ | |
"bar": "qwwx", | |
"hams": [ | |
1, | |
2 | |
], |
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 SumOfMultiples | |
def initialize(*ints) | |
@numbers = ints.to_a | |
end | |
def self.to(max) | |
new(3, 5).to(max) | |
end | |
def to(max) |
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 'nokogiri' | |
require 'open-uri' | |
class CardGenerator | |
def initialize(format) | |
@format = format | |
end | |
def random_card | |
html = "" |
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 print_numbers | |
@file.each do |line| | |
number = clean_number([:homephone]) | |
puts number | |
end | |
end | |
def clean_number(original) | |
number = number.delete(".").delete("-").delete(" ").delete("(").delete(")") | |
#There must be a shorter way to deal with this..? |
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
%li.search-business | |
= link_to(searches_path(:t => "1")) do | |
%i.icon-star | |
Business |
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 Audio < ActiveRecord::Base | |
def self.sync! | |
[Audio::ProgramAudio, Audio::DirectAudio, Audio::EncoAudio].each do |klass| | |
klass.sync! | |
end | |
end | |
class EncoAudio < Audio | |
def self.sync! | |
AudioSyncher.new(foo, bar).sync_awaiting_audio_if_file_exists! |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 find_and_replace_in_source_files(find, replace) | |
extensions = %w[.rhtml .rxml .erb .builder .rb .css .js .rake] | |
files = Dir["**/*"] | |
files.each do |file_name| | |
next if (file_name =~ /^vendor/) || !extensions.include?(File.extname(file_name)) | |
text = File.open(file_name, 'r'){ |file| file.read } | |
changed = text.gsub!(find, replace) | |
File.open(file_name, 'w'){|file| file.write(changed)} if changed | |
end |