Skip to content

Instantly share code, notes, and snippets.

View reu's full-sized avatar

Rodrigo Navarro reu

View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@sergiolopes
sergiolopes / README.md
Last active February 11, 2024 23:57
A script to generate SVG sprites, including CSS and PNG fallbacks.

Commandline output

$ ruby treetoar.rb 
SELECT "topics".* FROM "topics"  WHERE "topics"."id" = 1
Topic.where(id: 1)
SELECT "topics".* FROM "topics"  WHERE "topics"."id" IN (1, 2, 3)
Topic.where(id: [1, 2, 3])

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.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

@jnape
jnape / FutureEither.scala
Created April 3, 2013 09:03
Making dealing with Future[Either[L, R]] palatable in Scala
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] = {
@oliland
oliland / gist:5416438
Created April 18, 2013 21:37
An example of using CIFilters to mess with UIViews on iOS.
- (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];
@arschles
arschles / twitterFutureToScala.scala
Created May 2, 2013 18:45
Converting a Twitter future to a Scala Future
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)
}
@afeld
afeld / gist:5704079
Last active April 21, 2025 15:11
Using Rails+Bower on Heroku
@fnando
fnando / giffy
Last active July 1, 2020 02:30
Export video files as GIF
#!/usr/bin/env bash
if [[ ! -f "$1" ]]; then
echo "=> Movie file not found"
exit 1
fi
tempfile=/tmp/output.gif
rm -f $tempfile
@guimello
guimello / decorators.py
Created July 11, 2013 01:48
Decorators examples in python.
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)