Skip to content

Instantly share code, notes, and snippets.

Avatar

Ches Martin ches

View GitHub Profile
@ches
ches / ExitStatus.scala
Created Feb 16, 2019
A cute little application exit status value class
View ExitStatus.scala
import scala.language.implicitConversions
/** A process exit status. */
sealed abstract class ExitStatus(val code: Int) extends Product with Serializable
/** Exit statuses used conventionally across components. */
object ExitStatus {
case object Success extends ExitStatus(0)
case object Error extends ExitStatus(1)
case object BadUsage extends ExitStatus(2) // 2 is conventional, e.g. bash builtins, grep
View keybase.md

Keybase proof

I hereby claim:

  • I am ches on github.
  • I am ches (https://keybase.io/ches) on keybase.
  • I have a public key ASCIZr7iDy6SDxfmm4ZmlI-IfCYak4OLkqMWqBI3lp8f7Qo

To claim this, I am signing this object:

@ches
ches / futureutils.scala
Created Jun 2, 2016
Extra Future combinators for Scala
View futureutils.scala
import java.util.concurrent.atomic.AtomicInteger
import scala.collection.generic.CanBuildFrom
import scala.concurrent._
import scala.util.{ Failure, Success }
/*
* Enrichments for some useful Future combinators absent from the standard
* library.
*
@ches
ches / .ctags
Last active Jul 16, 2018 — forked from mfwarren/.ctags
my .ctags syntax file for Groovy language (exuberant-ctags)
View .ctags
--langdef=groovy
--langmap=groovy:.groovy
--regex-groovy=/^[ \t]*package[ \t]+([a-zA-Z0-9.-_]+)/\1/p,package/
--regex-groovy=/^[ \t]*(private|public)?[ \t]*(abstract|final|static)?[ \t]*class[ \t]+([A-Za-z0-9_]+)/\3/c,class/
--regex-groovy=/^[ \t]*(private|public)?[ \t]*interface[ \t]+([A-Za-z0-9_]+)/\2/i,interface/
--regex-groovy=/^[ \t]*(private|public)?[ \t]*trait[ \t]+([A-Za-z0-9_]+)/\2/t,trait/
--regex-groovy=/^[ \t]*(private|public)?[ \t]*enum[ \t]+([A-Za-z0-9_]+)/\2/e,enum/
--regex-groovy=/^[ \t]*[(abstract|final|static) \t]*((def|void|byte|int|short|long|float|double|boolean|char|[A-Z][a-zA-Z0-9_]*)[ \t]+)?([a-zA-Z0-9_]+\(.*\))[ \t]+/~\3/m,package method/
--regex-groovy=/^[ \t]*public[ \t]+[(abstract|final|static) \t]*((def|void|byte|int|short|long|float|double|boolean|char|[A-Z][a-zA-Z0-9_]*)[ \t]+)?([a-zA-Z0-9_]+\(.*\))[ \t]+/+\3/m,public method/
--regex-groovy=/^[ \t]*protected[ \t]+[(abstract|final|static) \t]*((def|void|byte|int|short|long|float|double|boolean|char|[A-Z][a-zA-Z0-9_]*)[ \t]+)?([a-
@ches
ches / Itembase-Sandbox.postman_environment
Last active Nov 18, 2015
Postman collection and environment (variables) for the Itembase API, initially imported from their Swagger spec. Import both into Postman and configure the environment with real values for your credentials. You'll need an OAuth access token for the user you're testing with, set as the `bearer_token` variable. Or alternatively, set up Postman's b…
View Itembase-Sandbox.postman_environment
{
"id": "d8ee1407-d7e2-60a3-f905-61896360d6e3",
"name": "Itembase – Sandbox",
"values": [
{
"key": "api_version",
"value": "v1",
"type": "text",
"name": "api_version",
"enabled": true
@ches
ches / mapfilter.go
Created Oct 28, 2015
A quick untyped map & filter example for Go. Author unknown, source: http://play.golang.org/p/yU6KUS1y5w
View mapfilter.go
package main
import "fmt"
type MapFunc func(interface{}) interface{}
type FilterFunc func(interface{}) bool
type Collection []interface{}
type User string
type Host string
@ches
ches / EventService.scala
Last active Dec 15, 2016
spray implicit allowing spray DateTimes to be deserialized from parameters directives
View EventService.scala
import spray.http.DateTime
import spray.httpx.unmarshalling._
/*
* Implicit allowing spray DateTimes to be deserialized from parameters directives.
*
* See: http://spray.io/documentation/1.2.2/spray-httpx/unmarshalling/
*/
// type FromStringOptionDeserializer[T] = Deserializer[Option[String], T]
@ches
ches / resources.md
Last active Aug 29, 2015
BKK Web Meetup - Big Data Open Panel, July 8th 2014 - Resources
View resources.md

Following are some resources referred to during the discussion, afterward in one-on-one chats, plus a few that I thought might be of interest for futher reading. As the panel turned out to be, these are mostly technical, with a few of interest to analyst types. I too wish that we had a bit more coverage of business case studies.

[Big Data: Principles and best practices of scalable realtime data systems][marz]

Nathan Marz and James Warren (Manning Publications)

A wealth of insight on building an architecture employing multiple data stores in order to serve differing latency requirements, and hedge risks and weaknesses. Marz initially developed Apache Storm for Backtype, acquired by Twitter. Still in "Early Access Edition" status, but all chapters are now available. If you're not technical but you'd like an introduction to the technical considerations, [Marz's post that led to the book][marz cap] is a briefer overview.

[Questioning the Lambda Architecture][kreps lambda]

View update-hipchat-hooks-event.rb
#!/usr/bin/env ruby
require 'netrc'
require 'octokit'
org_name = ARGV[0]
unless org_name
abort "Usage #{$0} org_name"
end
@ches
ches / snippet.js
Last active Dec 20, 2015
analytics.js load routine annotated
View snippet.js
// Create a queue, but don't obliterate an existing one!
var analytics = analytics || [];
(function () {
// A list of all the methods we want to generate queueing stubs for.
var methods = [
'identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit',
'page', 'pageview', 'ab', 'alias', 'ready', 'group'
];
You can’t perform that action at this time.