This file contains 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 age(sec) | |
years_float = sec.to_f / 60 / 60 / 24 / 365 | |
years_int = sec / 60 / 60 / 24 / 365 | |
months = (years_float - years_int) * 12 | |
puts "I'm #{years_int} years and #{months.to_i} months old." | |
end | |
age 979000000 | |
age 2158493738 | |
age 2461144023 |
This file contains 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
// Error checking taken out for brevity | |
io.sockets.on('connection', function(client){ | |
client.on('capture', function (url) { | |
var webshotOptions = { | |
screenSize: { width: 620, height: 620 }, | |
shotSize: { width: 620, height: 620 } | |
}, | |
pageObj = {}, |
This file contains 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 Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
filetype off " Required for vundle | |
set shell=bash " Make vim friendly with fishshell | |
set encoding=utf-8 " Set default encoding to UTF-8 | |
set noswapfile | |
set nobackup " Never let vim write a backup file, they did that in the 70's |
This file contains 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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 ( | |
"encoding/csv" | |
"encoding/json" | |
"fmt" | |
"os" | |
"strconv" | |
) |