Skip to content

Instantly share code, notes, and snippets.

@MrBri
MrBri / csv2json.go
Created August 17, 2017 07:09
golang csv2json
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"os"
"strconv"
)
@MrBri
MrBri / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
" 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
@MrBri
MrBri / server
Created April 1, 2013 21:36
Take a screen shot of a website, resize it, and emit it back to the client.
// 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 = {},
@MrBri
MrBri / challenge1.rb
Created May 27, 2012 20:38
Challenge 1 in the forums from Ruby Core at rubylearning.org
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