Skip to content

Instantly share code, notes, and snippets.

@joakimk
joakimk / README.md
Last active January 1, 2022 23:21
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
@bugant
bugant / dining_philosophers.rb
Last active December 30, 2015 08:16
Dining Philosophers solution using Celluloid
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'celluloid'
class Table
include Celluloid
CHOPSTICK_FREE = 0
CHOPSTICK_USED = 1
@teamon
teamon / Auth.scala
Created April 8, 2012 13:43
Play2.0 with Github OAuth2 example
package controllers
import lib._
import play.api.mvc._
import play.api.libs.json._
object Auth extends Controller {
val GITHUB = new OAuth2[GithubUser](OAuth2Settings(
@guillaumebort
guillaumebort / Secured.scala
Created April 7, 2012 12:05
HTTP Basic Authorization for Play 2.0
def Secured[A](username: String, password: String)(action: Action[A]) = Action(action.parser) { request =>
request.headers.get("Authorization").flatMap { authorization =>
authorization.split(" ").drop(1).headOption.filter { encoded =>
new String(org.apache.commons.codec.binary.Base64.decodeBase64(encoded.getBytes)).split(":").toList match {
case u :: p :: Nil if u == username && password == p => true
case _ => false
}
}.map(_ => action(request))
}.getOrElse {
Unauthorized.withHeaders("WWW-Authenticate" -> """Basic realm="Secured"""")