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
christos / gist:9616652
Last active Jun 20, 2018 — forked from samwgoldman/gist:9610193
Presigned S3 urls
View gist:9616652
access_key_id = ENV.fetch("APP_S3_ACCESS_KEY_ID")
secret_access_key = ENV.fetch("APP_S3_SECRET_ACCESS_KEY")
bucket_name = ENV.fetch("APP_S3_BUCKET")
s3 = access_key_id, secret_access_key: secret_access_key)
bucket = s3.buckets[bucket_name]
object = bucket.objects["whatever/you/want"]
presign =
presign.presign(:put, expires: 15.minutes.from_now.to_i)
# => #<URI::HTTP:0x007fcfcd97e1a0 URL:***stuff***>
View method_profiler.rb
require 'benchmark/ips'
require 'redis'
class MethodProfiler
def self.patch(klass, methods, name)
patches = do |method_name|
unless defined?(#{method_name}__mp_unpatched)
alias_method :#{method_name}__mp_unpatched, :#{method_name}
def #{method_name}(*args, &blk)
unless prof = Thread.current[:_method_profiler]
View database.yml
default: &default
adapter: mysql2
encoding: utf8mb4
username: root
host: localhost
View GistList!.md

##alt text GistList: TODO for coders alt text

View distribution.rake
def build_path
def ipa_name
'"Today\'s Shirts.ipa"'
def dsym_name
'"Today\'s Shirts.dSYM"'
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 Nov 27, 2015 — forked from wvengen/
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

christos /
Created Nov 13, 2015 — forked from brandonb927/
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
# Alot of these configs have been taken from the various places
# on the web, most from here
# Set the colours you can use
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

You can’t perform that action at this time.