Skip to content

Instantly share code, notes, and snippets.

View andremedeiros's full-sized avatar
:shipit:

André Medeiros andremedeiros

:shipit:
View GitHub Profile
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP JS 0.0.1
Comment: https://keybase.io/crypto
wcFMA9xpXI1SoNwqAQ/+IDtM5wOpxqsrxRpZUW9IQlciTDLBUYb4fCdtgU1/E9CW
ANY5p51/qDJTTE1TJDFKjz20505k06fCZdhT4klHoeFtezEnc3uYPFR0Qb8GqJLS
hYWOu/ANlzy2STn0uRsaAbTD2B44fR7XZCBXsNEtoOgcvt7ylTOXszZjvLk7istt
01wftl+P/Y03bjZtgc4PvBdv0uytq366vIlIqfo0kbAC7ffajd4AdriaD9UIU4S6
eQpEUIe/u20cEIDIYleuckYP4sTj9KzJtbRopH5C4js2+neJJ3IEfmL5bMbSmtRu
xLn5BuZ2T9HM/sfF6QRyI7TRfDJXz3lUSJyboy+upoQNdPMibW7x5SKoHcdcbPtt
~/Development/sandbox
❯ dbundle gem foobar --ext
create foobar/Gemfile
create foobar/Rakefile
create foobar/LICENSE.txt
create foobar/README.md
create foobar/.gitignore
create foobar/.consolerc
create foobar/foobar.gemspec
create foobar/lib/foobar.rb
@andremedeiros
andremedeiros / apploop.diff
Created May 13, 2014 16:46
OS X App loop in ruby
From 2b0c152b9eacdbcbdb47c3aadf47f75b0d373e17 Mon Sep 17 00:00:00 2001
From: Andre Medeiros <me@andremedeiros.info>
Date: Tue, 13 May 2014 17:45:26 +0100
Subject: [PATCH] Run an application loop.
---
ext/skruby/extconf.rb | 2 +-
ext/skruby/skruby.m | 3 +++
ext/skruby/skruby_application.h | 8 ++++++++
ext/skruby/skruby_application.m | 36 ++++++++++++++++++++++++++++++++++++
% Copyright (C) 2001-2012 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
// Copyright (c) Sergey Lyubka, 2013.
// All rights reserved.
// This program is used to embed arbitrary data into a C binary. It takes
// a list of files as an input, and produces a .c data file that contains
// contents of all these files as collection of char arrays.
// Usage:
// 1. Compile this file:
// cc -o embed embed.c
//
void
dz_cmyk_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *cmyk, float *rgb) {
static cmsHTRANSFORM transform = NULL;
if(!transform) {
cmsHPROFILE cmyk_profile, rgb_profile;
size_t cmyk_size, rgb_size;
const char *cmyk_data = find_embedded_file("cmyk.icc", &cmyk_size);
class ApplicationController < ActionController::Base
protected
# Protected: Internally redirects and renders a request.
#
# Example:
#
# def latest
# post = Post.last
@andremedeiros
andremedeiros / talks.md
Last active August 29, 2015 14:06
Baruco 2014 talks

Baruco 2014 talks

Please see the Hackpad where we can all contribute!

yes = -> { puts "Y"; true }
no = -> { puts "N"; false }
arr = [no, no, no, yes, no, no]
a = arr.find { |x| x.call }
puts a
# `a` wants to be true, not an instance of Proc
@andremedeiros
andremedeiros / services.rb
Created November 1, 2014 19:21
An experiment with services
require 'ostruct'
class Context < OpenStruct
def fail(details)
@_failure = true
@_error = details
end
def fail!(details)
fail(details)
throw :halt