- Don't do auth yourself, use devise. It gives you tons for free, including email confirmation and password resetting.
- Geokit-Rails for geolocation logic:
- Simple Form makes generating HTML forms in rails much easier.
- If you are going to upload files:
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
# original text is from http://www.bacterio.net/-classifphyla.html | |
# load hard-coded filename LPSN.txt into a string | |
# create a File object from LPSN.txt | |
line_array = File.readlines("LPSN.txt") or die "LPSN.txt not found." | |
# todo: parse lines your own way if it helps separate genuses. | |
# todo: grab this data directly from the website | |
# use the included date to report how old the current genus table is | |
# phylum = "no phylum" |
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 'benchmark' | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'mqtt' | |
MQTT::Client.connect('localhost') do |c| | |
message_count = -1 # ignore the first message because reasons. | |
start_time = nil | |
end_time = nil |
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
desc 'download all s3 files for a given bucket' | |
task :download_s3 do | |
s3 = AWS::S3::Client.new | |
bucket_name = ENV['AWS_S3_BUCKET'] | |
FileUtils.mkdir_p('tmp/s3_dump') | |
next_marker = '' | |
begin | |
resp = s3.list_objects bucket_name: bucket_name, marker: next_marker | |
resp.contents.each do |f| | |
dest = Rails.root.join("tmp/s3_dump", f.key) |
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
if @valid_networks == nil || @valid_networks == false | |
@valid_networks = [] | |
end | |
@valid_networks = @valid_networks || [] | |
@valid_networks ||= [] |
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
"Structure and Interpretation of Computer Programs" <- MITs CS text book for years. You will build a complete Scheme implementation by the end of the book. | |
"Confident Ruby" <- great book that has had a very positive effect on the way I use Ruby | |
"Practical Object-Oriented Design in Ruby" <- On my reading list, having a huge impact in the ruby community | |
"Smart and Gets Things Done" <- great book that has greatly affected how we hire | |
"The Pragmatic Programmer" <- Classic CS/SE text, heavily influential | |
"Cold as Ice" (and its series) <- Great hard science fiction novel (I have spare copies) | |
"Ender's Game" <- I despise the author from the bottom of my soul, but his books are good. | |
"The Mythical Man Month" <- Classic project management text, heavily influential | |
"Surely You are Joking Mr. Feynman" <- Richard Feynman's autobiography. Hilarious. | |
"1984" <- because 2016 will be like 1984. |
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
failures = Resque::Failure.count | |
failures.times do |i| | |
print "#{i}." | |
failure_id = failures - 1 - i | |
begin | |
Resque::Failure.remove(failure_id) if Resque::Failure.all(failure_id)["payload"]["args"].first["job_class"] == "SyncOrders" | |
rescue JSON::ParserError | |
Resque::Failure.remove(failure_id) | |
end | |
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
class SimpleUploaded < ActiveRecord::Base | |
mount_uploader :uploaded_file, SomeUploader | |
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
################################################################################################## | |
# AdvancedSolarPanels Molecular Transformer Recipes # | |
################################################################################################## | |
# Format of recipe: "inputItem:stackSize;outputItem:outputStackSize;energy" # | |
# InputItem (outputItem) format: # | |
# "oredict:forgeOreDictName" or "minecraft:item_name-meta" or "modID:item_name-meta" # | |
# New line = new recipe. # | |
# Add "#" before line to skip parsing recipe # | |
################################################################################################## | |
version=1.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
class Foo | |
attr_accessor :accessord | |
def defd | |
@defd | |
end | |
end | |
foo = Foo.new | |
t = 10_000_000 | |
result = Benchmark.bm do |b| |