Skip to content

Instantly share code, notes, and snippets.

@ancorcruz
ancorcruz / RailsCookieDebugging.rb
Created March 18, 2021 12:34 — forked from danmayer/RailsCookieDebugging.rb
Debugging Growing Cookies and Cookie Overflows
####
# This can be inserted in a before filter, or an endpoint causing cookie overflows
# this will log data for users who are approaching the max_cookie_size
# it will also for the most common cookie to overflow session, break down the size by key value pairs.
# This logs cookie and key names, but none of the data which may include PII, it just logs the byte sizes
#
# How to read:
# Cookie Debug (size: 3280) # overall cookies total size in bytes
# [COOKIE_NAME] size=IN_BYTES # these are sorted by smallest to largest byte size
# session: [KEY] size=IN_BYTES # for the session cookie, the key name with values in byte size sorted
The following is a list of places where you can find job offers as a Rails developer:
http://www.workingnomads.co/jobs
https://weworkremotely.com/jobs/search?term=rails
https://jobs.github.com/
http://www.indeed.com/q-Ruby-On-Rails-Developer-jobs.html
http://careers.stackoverflow.com/jobs/tag/ruby-on-rails
http://www.authenticjobs.com/#search=rails
# Spain Only
# Sprockets 2 does this, but Sprockets 3 axed this feature.
namespace :deploy do
after :normalize_assets, :gzip_assets do
on release_roles(fetch(:assets_roles)) do
assets_path = release_path.join('public', fetch(:assets_prefix))
within assets_path do
execute :find, ". \\( -name '*.js' -o -name '*.css' \\) -print0 | xargs -0 gzip --keep --best --quiet --force"
end
end
end
@ancorcruz
ancorcruz / 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,
@ancorcruz
ancorcruz / copy-s3-bucket.rb
Created October 25, 2012 13:12 — forked from zefer/copy-s3-bucket.rb
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Useful for transferring large amounts of data and will work across geographic regions.
require 'rubygems'
require 'right_aws'
aws_access_key_id = 'your-access-key'
aws_secret_access_key = 'your-secret-key'
target_bucket = 'your-source-bucket'
destination_bucket = 'your-destination-bucket'
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key)
@ancorcruz
ancorcruz / Instructions.markdown
Created January 25, 2012 11:05 — forked from albertoperdomo/Instructions.markdown
Setting up a new machine

Setting up a new Mac for web development with Rails

This is my own howto to setup new machines, but you might find it helpful as well.

## General settings

  • In Finder -> Preferences set it to show your home folder, hard drives, external drives, filename extensions, etc.
  • Make Finder show Library: run chflags nohidden ~/Library/ within a terminal
  • Disable holding key pressed to display accents and enable repeat keys: defaults write -g ApplePressAndHoldEnabled -bool false
  • In Preferences->Dock Select "Scale Effect" in the "Minimize Using" field and deselect the "Animate Opening Applications" option.
# Login and change root password
# create the user account you are going to use to connect
adduser myuser
# add the user to sudoers
visudo
#add a line like this at the end
myuser ALL=(ALL) ALL
##formtastic_datepicker_interface
module Formtastic
module DatePicker
protected
def datepicker_input(method, options = {})
format = options[:format] || ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default] || '%d %b %Y'
string_input(method, datepicker_options(format, object.send(method)).merge(options))
end
@ancorcruz
ancorcruz / .gitconfig
Created November 21, 2009 16:43 — forked from albertoperdomo/.gitconfig
Colourify git output
#Put this at the end of your file:
[alias]
pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master"
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green