Skip to content

Instantly share code, notes, and snippets.

View felixyz's full-sized avatar

Felix Holmgren felixyz

View GitHub Profile
@felixyz
felixyz / crash_burn_symbols.rb
Last active December 13, 2015 17:38
Crash caused by archiving/dearchiving symbols in RubyMotion. I can't get an interesting stack trace out of this, and NSZombiesEnabled doesn't give me anything either, but the original bug that set me hunting did result in "-[Symbol methodSignatureForSelector:]: message sent to deallocated instance" (with zombies turned on). It doesn't seem to me…
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@stuff = []
NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: "crash", userInfo:nil, repeats: true)
NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: "burn", userInfo:nil, repeats: true)
true
end
def crash
puts "crash"
@felixyz
felixyz / pretty-date.rb
Created September 17, 2012 21:23 — forked from rjz/pretty-date.rb
Pretty Date in Ruby
# Nothin' special here: just Resig's pretty date function ported to Ruby
# http://ejohn.org/blog/javascript-pretty-date/
def pretty_date(stamp)
now = Time.new
diff = now - stamp
day_diff = ((now - stamp) / 86400).floor
day_diff == 0 && (
diff < 60 && "just now" ||
@felixyz
felixyz / gist:872d0567e0d58d6e6aac
Created March 16, 2015 16:06
dokku nginx config http + https
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
@felixyz
felixyz / runflora log
Last active August 29, 2015 14:11
Flora-2 failures on OSX
$ ./flora2/runflora
% Specialising partially instantiated calls to flora_assert_directories/1
[Compiling Foreign Module /Users/felix/Documents/code/flora2/flora2bundle/flora2/cc/prolog2hilog (Prolog compiler options are ignored)]
[prolog2hilog compiled, cpu time used: 0.0010 seconds]
[Compiling C file /Users/felix/Documents/code/flora2/flora2bundle/flora2/cc/prolog2hilog.c using gcc]
/Users/felix/Documents/code/flora2/flora2bundle/flora2/cc/prolog2hilog.c:365:9: warning: comparison of 0 > unsigned expression is always false [-Wtautological-compare]
if (0 > length_diff) return FALSE;
~ ^ ~~~~~~~~~~~
1 warning generated.
gcc -dynamiclib -undefined dynamic_lookup -fPIC -o /Users/felix/Documents/code/flora2/flora2bundle/flora2/cc/prolog2hilog.dylib /Users/felix/Documents/code/flora2/flora2bundle/flora2/cc/prolog2hilog.c -Wall -fPIC -I/Users/felix/Documents/code/flora2/flora2bundle/XSB/emu -I/Users/felix/Documents/code/flora2/flora2bundle/XSB/config/i386-apple-darwin13.2.0 -O3 -fno-strict-aliasing -
@felixyz
felixyz / sidekiq_unique_jobs_bug_spec.rb
Created February 3, 2014 09:43
RSpec script attempting (and failing) to reproduce sidekiq-unique-jobs issue #27. https://github.com/mhenrixon/sidekiq-unique-jobs/issues/27
require 'spec_helper'
require 'sidekiq'
require 'sidekiq/middleware/chain'
require 'sidekiq/fetch'
require 'sidekiq/processor'
require 'redis/namespace'
redis_url = 'redis://localhost/15'
client = Redis.connect(:url => redis_url)