Skip to content

Instantly share code, notes, and snippets.

View jordanorelli's full-sized avatar
🎴

Jordan Orelli jordanorelli

🎴
View GitHub Profile
begin
response = call_api # this might throw X
response.save_to_db # this might throw Y
rescue X
# handle the error with calling the api
rescue Y
# handle the error with saving to the database
rescue Exception => e
# handles *any* exception; maybe you got the exception type wrong?
end
diff --git a/lib/lex.go b/lib/lex.go
index 885ec08..8242d5a 100644
--- a/lib/lex.go
+++ b/lib/lex.go
@@ -404,7 +404,8 @@ func lexNumber(l *lexer) stateFn {
imaginary := l.accept("i")
r := l.next()
if isAlphaNumeric(r) {
- return lexErrorf("unexpected alphanum in lexNumber: %c", r)
+ l.keep(r)
package main
import (
"fmt"
"io"
"net/http"
"net/http/httputil"
"os"
"strings"
"unicode"
package main
import (
"fmt"
"io"
"net/http"
"net/http/httputil"
"os"
"strings"
"unicode"
jorelli@ETSYNY-L645[0] /projects/moon: cat ex.moon
# ------------------------------------------------------------------------------
# example config format
#
# this is a working draft of things that are valid in a new config language to
# replace json as a config language for Go projects.
#
# comments are a thing now!
# ------------------------------------------------------------------------------
[
{
"create_date": 1429079065,
"dataset_name": "ShopHome_RecentFavorites",
"hostname": "datasets01.ny5.etsy.com",
"load_id": 23278596676,
"replicant": 0,
"shard": 0,
"status": "ready-to-load",
"update_date": 1429079065,
#!/usr/bin/env ruby
# workaround-upstart-snafu
#
# When lied to about the behavior of a job’s main process wrt. forking with the
# “expect” stanza, Upstart can get into a confused state where it’s tracking a
# nonexistent pid.
#
# This hack creates new short-lived processes until one gets the pid in
# question, then has its parent die so that it’s going to get reaped by pid 1
# ------------------------------------------------------------------------------
# Cluster config
# ------------------------------------------------------------------------------
default_network: {
name: "default"
servers: ["localhost:9991"]
ssl_ca: "/etc/pki/logstash/lumberjack_development.crt"
timeout: 180
}
# Server
redis_version:2.6.14
redis_git_sha1:00000000
redis_git_dirty:0
redis_mode:standalone
os:Linux 2.6.32-431.11.2.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.6
process_id:31144