Updated for Rails 4.0.0+
-
Set up the
bower
gem. -
Follow the Bower instructions and list your dependencies in your
bower.json
, e.g.// bower.json
{
require 'bundler/setup' | |
require 'active_record' | |
include ActiveRecord::Tasks | |
db_dir = File.expand_path('../db', __FILE__) | |
config_dir = File.expand_path('../config', __FILE__) | |
DatabaseTasks.env = ENV['ENV'] || 'development' |
{-# LANGUAGE ScopedTypeVariables #-} | |
module MergeSort where | |
import Control.Monad.ST | |
import Control.Monad (forM_, when) | |
import Data.Array.ST | |
import Data.STRef | |
-- Required for tests only |
from time import time | |
# Decoratoring with a class | |
class Benchmark(object): | |
def __init__(self, function): | |
self.function = function | |
def __call__(self, *args, **kwargs): | |
t1 = time() | |
result = self.function(*args, **kwargs) |
#!/usr/bin/env bash | |
if [[ ! -f "$1" ]]; then | |
echo "=> Movie file not found" | |
exit 1 | |
fi | |
tempfile=/tmp/output.gif | |
rm -f $tempfile |
Updated for Rails 4.0.0+
Set up the bower
gem.
Follow the Bower instructions and list your dependencies in your bower.json
, e.g.
// bower.json
{
import com.twitter.util.{Future => TwFuture} | |
import scala.concurrent.{Future => ScFuture, promise => scPromise} | |
implicit def twFutureToScala[T](twFuture: TwFuture[T]): ScFuture[T] = { | |
val prom = scPromise[T] | |
twFuture.onComplete { res: T => | |
prom.success(res) | |
} | |
twFuture.onFailure { t: Throwable => | |
prom.failure(t) | |
} |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Great tutorial: http://www.raywenderlich.com/22167/beginning-core-image-in-ios-6 | |
// Official docs: https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185-CH1-TPXREF101 | |
// Alt-click on function names for more! | |
// Make any old label, with our frame set to the view so we know it's there. | |
UILabel *label = [[UILabel alloc] initWithFrame:self.view.frame]; |
package com.thoughtworks.futureeither | |
import concurrent.{Await, Future} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import concurrent.duration.FiniteDuration | |
import java.util.concurrent.TimeUnit | |
class FutureEither[L, R](private val future: Future[Either[L, R]]) { | |
def flatMap[R2](block: R => FutureEither[L, R2]): FutureEither[L, R2] = { |
This is a proof-of-concept of a couple of concurrent data structures written in Ruby.
The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.
AtomicLinkedQueue
is a lock-free queue, built on atomic CAS operations.