Skip to content

Instantly share code, notes, and snippets.

View rynmrtn's full-sized avatar

Ryan Morton rynmrtn

View GitHub Profile
@rynmrtn
rynmrtn / timeout_and_tick.go
Created August 3, 2017 01:07 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@rynmrtn
rynmrtn / timeout_and_tick.go
Created August 3, 2017 01:07 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@rynmrtn
rynmrtn / .gitattributes
Created September 18, 2010 17:18 — forked from program247365/.gitattributes
Obj-c git setup
*.pbxproj -crlf -diff -merge
@rynmrtn
rynmrtn / insert.groovy
Created January 22, 2010 21:26 — forked from atonse/insert.groovy
Groovy Script to Generate Insert Statements
/**
This groovy script will take a CSV file that represents the data
in a database. The first row should be the name of the columns and
all other rows should represent the data you wish to insert.
The #generate_insert function also assumes that the csv file has the
same name as the sql table that is being inserted into
*/
// Setup basic information