Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile
@alloy
alloy / 0_reuse_code.js
Created January 30, 2014 13:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@alloy
alloy / zomg.rb
Created February 14, 2014 10:44
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.
def presentAlert
alert = UIAlertView.new
# ...
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)
end

Keybase proof

I hereby claim:

  • I am alloy on github.
  • I am alloy (https://keybase.io/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:

-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP JS 0.0.1
Comment: https://keybase.io/crypto
wcFMA55jOJSjVDEMAQ//bTh+5x0K3UqwKC47nExojQj8C6REA7GRVLHbPxq2oCKQ
g5iPDlrAk/uVfO+ZscnDpeJ9IhvCXxnPjv8aYMsKaUq4kYl1Lg1624yKi4mZleUR
m3hFeURT8h0vlyt+78LX/phW5+vhSQsv46JPLe9iaSkvynIPlX6QJlHhSFVr6EzC
yubS0WRaaNse6EDah+tpP92YTiQ4/4dhWWcW0/LkEhktL7PbWUN1uHNjaEXWRGYH
8lJUiK6NLhZ8K3oNHMZaA2haWjGqfYL6BDLOsKekAq8Hqv9lTUMYOGEXyQOqiZ4T
2b0zUziEefCprLcW9eP1Owv197TJAmi37utPOiLsKs6fTbByaVmpwE5iC6/z3a6A
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 = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x00007fff8d48775b libobjc.A.dylib`_objc_trap()
libobjc.A.dylib`_objc_trap():
-> 0x7fff8d48775b: ud2
libobjc.A.dylib`__objc_error:
0x7fff8d48775d: pushq %rbp
0x7fff8d48775e: movq %rsp, %rbp
From a147862c9fcfe0cf57f1e664ce4ea1dd263f4af2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= <eloy.de.enige@gmail.com>
Date: Thu, 20 Mar 2014 17:27:49 +0100
Subject: [PATCH] Work around RubyMotion bug by (un)boxing args in objc.
Related to http://hipbyte.myjetbrains.com/youtrack/issue/RM-448.
---
rubymotion/BaseTableViewCell/BaseTableViewCell.h | 5 +++++
rubymotion/BaseTableViewCell/BaseTableViewCell.m | 17 +++++++++++++++++
rubymotion/Rakefile | 1 +
# Adapted from https://github.com/irrationalfab/PrettyBacon
module PrettyBacon
def self.color(color, string)
case color
when :red
"\e[31m#{string}\e[0m"
when :green
"\e[32m#{string}\e[0m"
when :yellow
#import <Foundation/Foundation.h>
@interface WTF : NSObject
-:x;
@end
@implementation WTF
-:x;
{
return x;
@alloy
alloy / README.md
Last active August 29, 2015 13:57
Fix system Ruby (2.0.0) on OS X 10.9.

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.