Skip to content

Instantly share code, notes, and snippets.


Eloy Durán alloy

View GitHub Profile
alloy / 0_reuse_code.js
Created Jan 30, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
alloy / zomg.rb
Created Feb 14, 2014
Some controls have internal subviews you’d want to modify, but you cannot control the class that’s used internally. This example shows extending just that singleton (the view instance) by defining the method inline. This is preferable to using ‘categories’, because those affect _all_ instances of that class.
View zomg.rb
def presentAlert
alert =
# ...
textField = alert.textFieldAtIndex(0)
# *Only for this UITextField instance*, move the leftView 4 points to the right.
def textField.leftViewRectForBounds(bounds)
CGRectOffset(super, 4, 0)

Keybase proof

I hereby claim:

  • I am alloy on github.
  • I am alloy ( on keybase.
  • I have a public key whose fingerprint is 31CE 6834 976D 30FF 32BC 1F07 E883 E2C2 8D09 DDD7

To claim this, I am signing this object:

View gist:9532579
Version: Keybase OpenPGP JS 0.0.1
View gist:9649159
objc[15403]: Cannot form weak reference to instance (0x100d53db0) of class NSMutableParagraphStyle. It is possible that this object was over-released, or is in the process of deallocation.
Process 15403 stopped
* thread #1: tid = 0x2fbdd8, 0x00007fff8d48775b libobjc.A.dylib`_objc_trap(), queue = '', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x00007fff8d48775b libobjc.A.dylib`_objc_trap()
-> 0x7fff8d48775b: ud2
0x7fff8d48775d: pushq %rbp
0x7fff8d48775e: movq %rsp, %rbp
View gist:9667982
From a147862c9fcfe0cf57f1e664ce4ea1dd263f4af2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= <>
Date: Thu, 20 Mar 2014 17:27:49 +0100
Subject: [PATCH] Work around RubyMotion bug by (un)boxing args in objc.
Related to
rubymotion/BaseTableViewCell/BaseTableViewCell.h | 5 +++++
rubymotion/BaseTableViewCell/BaseTableViewCell.m | 17 +++++++++++++++++
rubymotion/Rakefile | 1 +
View gist:9738848
# Adapted from
module PrettyBacon
def self.color(color, string)
case color
when :red
when :green
when :yellow
View gist:9830968
#import <Foundation/Foundation.h>
@interface WTF : NSObject
@implementation WTF
return x;
alloy /
Last active Aug 29, 2015
Fix system Ruby (2.0.0) on OS X 10.9.
View trunk-web-hooks.markdown

The Trunk app and other CocoaPods web-services.

As we don’t want to make the launch process even harder, we’re not adding real web-hooks soon, at least not before the launch. So to communicate that new data (new pod or version) is available, we will share the Trunk DB, but start to abstract away details as soon as possible.

We do however have to send some form of web-hook from Trunk to the other web-services, because if we continue to keep using GitHub web-hooks for this then we cannot trust that Trunk has been updated all its data before any of the other web-services tries to query the Trunk DB. (I.e. other services might receive/process the GitHub web-hook earlier than Trunk.)

Soon after launch

  • The other web-services maintain their own tables in the shared DB. This means those apps have the freedom to define their own DB schema migrations, as long as they don’t collide with Trunk’s schema.
  • The other web-services may make foreign-key references to tables belonging to Trunk.
You can’t perform that action at this time.