Skip to content

Instantly share code, notes, and snippets.

const color = (() => {
const RESET = '\x1b[0m'
const BRIGHT = '\x1b[1m'
const DIM = '\x1b[2m'
const RED = '\x1b[31m'
const GREEN = '\x1b[32m'
const YELLOW = '\x1b[33m'
const BLUE = '\x1b[34m'
const MAGENTA = '\x1b[35m'
const CYAN = '\x1b[36m'

There are 3 tools/tricks which are pretty essential to writing Go code on a team or open source project which I highly recommend:

  1. Set up your editor to automatically run the code through goimports once you hit save.

    It's extremely fast. It formats your code using the standard gofmt tool. It automatically adds/removes/organizes your import lines. Note that Go uses tabs, so I recommend setting your editor's tab-width to 2 or 4, whichever you're used to. Anything but 8. Editor support:

@bobisme
bobisme / bobs-notes.md
Last active September 18, 2023 20:41
Bob's notes

no notes

Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@bobisme
bobisme / js-array-parallel-map-reduce.js
Created February 24, 2017 02:03
Extending Array.prototype with "parallel" mappers and reducers.
Array.prototype.paraMap = function(...fns) {
return fns.map(fn => this.map(fn))
}
Array.prototype.paraReduce = function(...fns) {
let reduceArgs
let init = fns[fns.length - 1]
if (typeof init !== 'function') {
reduceArgs = fns.slice(0, -1).map(fn => [fn, init])
} else {

Keybase proof

I hereby claim:

  • I am bobisme on github.
  • I am bobisme (https://keybase.io/bobisme) on keybase.
  • I have a public key ASABMBDuzDkAc3XzKqIyn4WFSfkPcmkzAK9zJq-YoM_g5Ao

To claim this, I am signing this object:

@bobisme
bobisme / how-i-start.md
Last active February 20, 2016 04:51
New git project using dropbox.

Make a new "bare" repo in dropbox

mkdir ~/Dropbox/git/new-project.git
git init --bare ~/Dropbox/git/new-project.git
cd ~/src
git clone ~/Dropbox/git/new-project.git

This creates the directory ~/src/new-project with dropbox as the "origin" remote.

cd new-project

@bobisme
bobisme / ripmaplist.js
Created February 3, 2015 17:35
1-line rip google map list to csv (jQuery)
$('.list-content').map(function(){return $(this.children).map(function(){return $(this).text()}).toArray().join('|')}).toArray().join('\n')
@bobisme
bobisme / install-qstk
Created September 29, 2014 03:23
Install QSTK in a virtual environment (with IPython).
mkvirtualenv qstk
pip install numpy scipy matplotlib
pip install pandas scikits.statsmodels scikit-learn
pip install QSTK
pip install "ipython[notebook]"
ipython notebook --pylab inline
@bobisme
bobisme / install-openerp-linux.mkd
Created May 15, 2014 07:22
Installing OpenERP in Linux virtualenv (Ubuntu 14.04)

Installing OpenERP on Ubuntu 14.04

Many steps taken from [code.zoia.org][].

Install dependencies

apt-get