Skip to content

Instantly share code, notes, and snippets.

@chrisgibson
chrisgibson / Gemfile
Created October 10, 2022 16:04
Rails + Stripe JS testing
group :test do
gem "roda"
end
@chrisgibson
chrisgibson / TokenAuthenticator.scala
Created January 30, 2014 20:08
Spray Token Authentication
import scala.concurrent.{ExecutionContext, Future}
import spray.routing.{AuthenticationFailedRejection, RequestContext}
import spray.routing.authentication.{Authentication, ContextAuthenticator}
/** Token based authentication for Spray Routing.
*
* Extracts an API key from the header or querystring and authenticates requests.
*
* TokenAuthenticator[T] takes arguments for the named header/query string containing the API key and
* an authenticator that returns an Option[T]. If None is returned from the authenticator, the request
@chrisgibson
chrisgibson / nook-sync.sh
Created November 29, 2010 02:24
Poor Man's Nook Sync
#!/bin/bash
#
# nook-sync
# TODO: Remove hard-coded (mac-specific) device mount dir.
# TODO: Provide option for 2-way syncing
# TODO: Provide option to delete files on device that aren't in sync dir
function usage {
cat << EOF