Skip to content

Instantly share code, notes, and snippets.

View christos's full-sized avatar

Christos Zisopoulos christos

View GitHub Profile
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]
example.run
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY")
else
ActiveRecord::Base.transaction do
# in rails application.rb
initializer "postgresql.no_default_string_limit" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit)
end
end
def build_path
"build/iPhoneOS-6.0-Release/"
end
def ipa_name
'"Today\'s Shirts.ipa"'
end
def dsym_name
'"Today\'s Shirts.dSYM"'
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/03-improve-gc-stats.patch
@christos
christos / gist:9616652
Last active June 20, 2018 22:31 — forked from samwgoldman/gist:9610193
Presigned S3 urls
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 = AWS::S3.new(access_key_id: access_key_id, secret_access_key: secret_access_key)
bucket = s3.buckets[bucket_name]
object = bucket.objects["whatever/you/want"]
presign = AWS::S3::PresignV4.new(object)
presign.presign(:put, expires: 15.minutes.from_now.to_i)
# => #<URI::HTTP:0x007fcfcd97e1a0 URL:***stuff***>
#!/bin/sh
### BEGIN INIT INFO
# Provides: haproxy
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fast and reliable load balancing reverse proxy
# Description: This file should be used to start and stop haproxy.
### END INIT INFO
@christos
christos / irpf.rb
Last active August 29, 2015 14:14 — forked from fxn/irpf.rb
# Usage:
#
# ruby irpf.rb tax_base
#
# Example:
#
# ruby irpf.rb 65300
# 65300 €, 22722 €, 34.8%
#
# Where 22,722 € is the IRPF to pay, and 34.8% is the real rate, that is,
@christos
christos / osx-for-hackers.sh
Created November 13, 2015 15:40 — forked from brandonb927/osx-for-hackers.sh
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...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@christos
christos / README.md
Created November 27, 2015 15:04 — forked from wvengen/README.md
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

default: &default
adapter: mysql2
encoding: utf8mb4
username: root
password:
host: localhost
variables:
sql_mode: TRADITIONAL,NO_AUTO_VALUE_ON_ZERO,ONLY_FULL_GROUP_BY
development: