Skip to content

Instantly share code, notes, and snippets.

Christos Zisopoulos christos

Block or report user

Report or block christos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5152970
# in rails application.rb
initializer "postgresql.no_default_string_limit" do
ActiveSupport.on_load(:active_record) do
View spec_helper.rb
RSpec.configure do |config|
config.around do |example|
# For examples using capybara-webkit for example.
# Remove this if you don't use it or anything similar
if example.metadata[:js]
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY")
ActiveRecord::Base.transaction do
christos /
Created Jun 15, 2012
RubyMotion runtime freeze on syntax error in an `each` block, when called from a callback

Hello everyone,

I've already asked on IRC and no one seemed to have an idea why the following is happening:

I can consistently get the RubyMotion runtime and the device to freeze when running this simple code ( with rake device and then hitting the Cancel button on the UIImagePicker. I am guessing this is related to callbacks in general, but I couldn't come up with a simpler example.

As you can see, the UIImagePicker callback method simply uses each to iterate over an array of strings, but as soon as it hits the syntax error on line 28 (putd) it stops. No exception in the logs, nothing. The process has to be killed to exit it.

Any ideas? Am I supposed to release/retain something? I know blocks are a bit tricky but I can't figure out what could possibly be causing the freeze, even if it was a NULL pointer or a missing reference

christos / gist:2037118
Created Mar 14, 2012
Twitter url shortener mangles iCloud journal urls
View gist:2037118
The original URL:
...when shortened to
...which incorrectly expands to:
christos / gist:1716942
Created Feb 1, 2012
Install ruby-debug19 with the latest ruby 1.9.3
View gist:1716942
curl -OL
curl -OL
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$rvm_path/src/`rvm current`
rm ruby-debug-base19-0.11.26.gem linecache19-0.5.13.gem
christos / monit.conf
Created Dec 17, 2011 — forked from shapeshed/monit.conf
Upstart script for monit on Ubuntu 10.04
View monit.conf
# This is an event.d (upstart) script to keep monit running.
# To install disable the old way of doing things:
# /etc/init.d/monit stop && update-rc.d -f monit remove
# then put this script here:
# /etc/init/monit.conf
# and reload upstart configuration:
View ssh-copy-id
curl "" -o ~/bin/ssh-copy-id
chmod +x ~/bin/ssh-copy-id
christos / profile_options_for_select.rb
Created Jul 27, 2011
Profile testing options_for_select
View profile_options_for_select.rb
require 'rubygems'
require 'thread'
require 'rails/all'
require 'benchmark'
include ActionView::Helpers::FormOptionsHelper
puts "Using #{`ruby -v`}"
@choices = 700.times.collect { [(0...50).map{ ('a'..'z').to_a[rand(26)] }.join, rand(10000)] }
View jazzfonica.rb
#!/usr/bin/env ruby
# jazzfonica.rb for Mac OS X
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password
# Ported from PHP example at
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal
require 'digest/md5'
messages = []
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport')
View rbeautify.rb
#!/usr/bin/ruby -w
* Copyright (C) 2008, Paul Lutus *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
You can’t perform that action at this time.