Skip to content

Instantly share code, notes, and snippets.

Database Cleaner:

group :test do ...
  gem "database_cleaner"
  ...
end

Support

@bobisme
bobisme / manywaystoskinamap.rb
Created August 4, 2017 13:52
Playing with ways to call map in Ruby.
# Originally posted here: https://glot.io/snippets/es9vhlp4hs
# ©2017 Bob. No rights reserved.
def some_func(x)
x + " sucks"
end
a = ["primus", "bob", "black hole"]
puts "\nthe most sane way"
@bobisme
bobisme / cond_wait.go
Created June 28, 2017 21:27
Example use of Cond.Wait
package main
import (
"fmt"
"sync"
"time"
)
func waitForSignal() {
var m sync.Mutex
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