Skip to content

Instantly share code, notes, and snippets.

View akitaonrails's full-sized avatar

Fabio Akita akitaonrails

View GitHub Profile
@akitaonrails
akitaonrails / gist:934ca421ed68f7df15fa
Created July 23, 2014 00:34
Linkedin Job - backup
Job Description
Work in self-managed cells for startup products and established companies' new products.
Work full time and focused on a single project at a time
Have autonomy to decide the best course of action with his peers on each project
Have a part in the decision of which technologies best suit each project
Help set expectations with the clients
Desired Skills and Experience
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
http://www.akitaonrails.com/2011/05/04/off-topic-opinioes-verdades-democracia-e-etica#.U5eB2RYduzA
http://www.akitaonrails.com/2013/10/30/off-topic-matematica-trolls-haters-e-discussoes-de-internet#.U5eB2BYduzA
http://www.akitaonrails.com/2013/11/02/off-topic-programadores-sao-pessimos-comunicadores-udp-vs-tcp#.U5eCKxYduzA
http://www.akitaonrails.com/2013/10/07/off-topic-noestimates-debunked#.U5eCLRYduzA
@akitaonrails
akitaonrails / human_gc_stats.rb
Created April 9, 2014 00:17
Just a hack to make it easier to understand GC.stat in Ruby 2.0 and 2.1 (made for a tech talk)
# This is an attempt to translate GC.stat to a more understandable format for humans
# from @samsaffron
# http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc?utm_source=rubyweekly&utm_medium=email
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
def gc_stats
stats = GC.stat
space_count = ObjectSpace.count_objects
objects_per_heap = space_count[:TOTAL] / stats[:heap_used]
report = {
@akitaonrails
akitaonrails / upgrading-vagrant-fusion.mdown
Created October 24, 2013 17:40
Upgrading Vagrant from the default Virtualbox provider to VMWare Fusion on the Mac

I had some headaches yesterday while trying to upgrade to VMWare Fusion with Vagrant.

The steps that work are:

  • export your boxes from Virtualbox to OVA files
  • run 'vagrant destroy' on all your boxes
  • uninstall Virtualbox using the uninstaller script in the installer DMG
  • download VMWare Fusion
  • run 'vagrant plugin install vagrant-vmware-fusion' to install the provider plugin
  • run 'vagrant plugin license vagrant-vmware-fusion license.lic' to install the license you just bought
@akitaonrails
akitaonrails / Gemfile
Created September 16, 2013 15:56
To make omniauth (facebook, g+, etc) work with Passenger and Heroku, following @phusion_nl demo https://github.com/phusion/passenger-ruby- heroku-demo you need to add the following
source 'https://rubygems.org'
# the rest of the file goes here
gem 'passenger', '~> 4.0.17'
@akitaonrails
akitaonrails / s3_cache_control.rb
Last active December 22, 2015 22:39
AWS S3 objects, used as uploaded images, must always set Cache-Control and Expires headers for proper browser caching
require 'rubygems'
require 'aws/s3'
AWS::S3::Base.establish_connection!(
:access_key_id => ENV['AWS_ACCESS_KEY'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
)
bucket = AWS::Bucket.find(ENV['AWS_BUCKET'])
bucket.objects.each do |s3_object|
@akitaonrails
akitaonrails / convert.rake
Created September 11, 2013 20:09
Rake Task to convert MySQL data into a Postgres database
#
# Convert/transfer data from production => development. This facilitates
# a conversion one database adapter type to another (say postgres -> mysql )
#
# WARNING 1: this script deletes all development data and replaces it with
# production data
#
# WARNING 2: This script assumes it is the only user updating either database.
# Database integrity could be corrupted if other users where
# writing to the databases.
@akitaonrails
akitaonrails / gist:6513776
Created September 10, 2013 18:44
Problem deploying Rails 4 app with Passenger 4 on Heroku
2013-09-10T18:41:54+00:00 heroku[slug-compiler]: Slug compilation started
2013-09-10T18:42:53.100630+00:00 heroku[api]: Deploy f449583 by fabioakita@gmail.com
2013-09-10T18:42:53.142535+00:00 heroku[api]: Release v35 created by fabioakita@gmail.com
2013-09-10T18:42:53.431106+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-10T18:42:54+00:00 heroku[slug-compiler]: Slug compilation finished
2013-09-10T18:43:11.300264+00:00 heroku[web.1]: Starting process with command `bundle exec passenger start -p 23466 --max-pool-size 3`
2013-09-10T18:43:15.147367+00:00 app[web.1]: /app/.passenger/standalone/4.0.8/nginx-1.4.1-x86_64-linux
2013-09-10T18:43:15.147367+00:00 app[web.1]:
2013-09-10T18:43:15.147367+00:00 app[web.1]: This will only be done once. Please sit back and relax while installation is
2013-09-10T18:43:15.147367+00:00 app[web.1]: in progress.
@akitaonrails
akitaonrails / Object_Framework.asp
Created May 26, 2013 22:21
Trechos de código que escrevi no ano 2000/2001 para ASP Classic inspirado no recém-lançado ASP.NET WebForms
<%
'
' This is the required interface that every element must implement
' in order to be usable by the global Page Class
' - Parent, Name, Value, IsType properties and required elements
' - Serialize, SetProperty and Render are required methods
'
Class Element
' type of this object