- IaaS dev @ Locaweb
- Java 2005 - 2008
- Android 2011-2012
- Ruby 2008 - Today
- @coralton
- github.com/lucasuyezu
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::collections::HashMap; | |
// Given a list of integers, use a vector and return the mean (the average value) | |
pub fn vec_mean(vec: &Vec<i32>) -> f64 { | |
let sum = vec_sum(&vec); | |
sum as f64 / vec.len() as f64 | |
} | |
// Given a list of integers, use a vector and return the median (when sorted, the value in the middle position) |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
) | |
func main() { | |
procs := runtime.GOMAXPROCS(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
puts "1) Fetching data" | |
http = EventMachine::HttpRequest.new("https://api.bitcoinaverage.com/ticker/global/all").get | |
http.errback { p '3) Not-done! Error!'; EM.stop } | |
http.callback do | |
# 1 second later | |
$redis.set(response_body["data"]) | |
puts "3) Storing fetched data" | |
p http.response_header.status | |
p http.response_header |
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
puts "Fetching data" | |
respose_body = HTTParty.get "https://api.bitcoinaverage.com/ticker/global/all" | |
# 1 second later | |
puts "Storing fetched data" | |
$redis.set(response_body["data"]) | |
puts "Done!" |
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
# Setup | |
$redis = Redis.connect | |
# Conversion | |
currency, amount = parse_tweet("0.5 in #USD") | |
result = convert('USD', 0.5) | |
reply("#{amount} in #{currency} is #{result}") | |
$redis.sadd("conversions", "#{amount} in #{currency} at #{Time.now}") | |
# Checking later |
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
# Setup | |
$conversions = 0 | |
# Conversion | |
currency, amount = parse_tweet("0.5 in #USD") | |
result = convert('USD', 0.5) | |
reply("#{amount} in #{currency} is #{result}") | |
$conversions += 1 | |
# Checking later |
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
# Good | |
class V2::BackupsController < ApplicationController | |
# All REST methods, as shown before | |
end | |
class V2::RestoresController < ApplicationController | |
def index | |
# List restores (via GET) | |
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
# Bad | |
class BackupsController < ApplicationController | |
def index | |
end | |
def show | |
end | |
# All other REST methods |
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
-rw------- 1 lucasuyezu staff 3 Sep 1 17:01 .CFUserTextEncoding | |
-rw-r--r--@ 1 lucasuyezu staff 21508 Sep 1 13:06 .DS_Store | |
drwx------ 8 lucasuyezu staff 272 Sep 1 20:21 .Trash | |
drwxr-xr-x 11 lucasuyezu staff 374 May 6 15:55 .atom | |
-rw------- 1 lucasuyezu staff 573 Jul 28 15:04 .bash_history | |
drwxr-xr-x 3 lucasuyezu staff 102 Jun 13 15:26 .berkshelf | |
drwxr-xr-x 2 lucasuyezu staff 68 Apr 4 15:26 .bin | |
drwxr-xr-x 4 lucasuyezu staff 136 Jul 28 15:03 .boot2docker | |
drwxr-xr-x 3 lucasuyezu staff 102 Apr 4 15:51 .bundle | |
-rw-r--r-- 1 lucasuyezu staff 422 Aug 4 19:05 .byebug_hist |
NewerOlder