Skip to content

Instantly share code, notes, and snippets.

View emaraschio's full-sized avatar
🏠
☕ 🤓

Ezequiel Maraschio emaraschio

🏠
☕ 🤓
View GitHub Profile
Gem
https://github.com/mileszs/wicked_pdf
Downloads
https://code.google.com/p/wkhtmltopdf/downloads/list?can=1&q=
Guides / Common issues
http://snikt.net/blog/2012/04/26/wicked-pdf/
https://gist.github.com/wrburgess/3778949
https://github.com/mileszs/wicked_pdf/wiki/Background-PDF-creation-via-delayed_job-gem
@emaraschio
emaraschio / How to install phantomjs in a vagrant precise32 machine
Last active August 29, 2015 14:06
How to install phantomjs in a vagrant precise32 machine
sudo apt-get install phantomjs
cd /usr/bin
sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2
sudo tar xjf phantomjs-1.9.2-linux-i686.tar.bz2
sudo ln -s phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
sudo rm phantomjs
sudo ln -s phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/bin/phantomjs
@emaraschio
emaraschio / PG::UndefinedTable Error on rspec tests
Last active August 29, 2015 14:07
For Example: PGError: ERROR: relation "users" does not exist
You need to execute the prepare and migrate command, to get all the schema up to date and with a good shape:
RAILS_ENV=test rake test:prepare
RAILS_ENV=test rake db:migrate
@emaraschio
emaraschio / Ruby Test Info
Created October 16, 2014 22:19
A few links about Testing with Ruby
Libraries:
http://cukes.info/
http://jnicklas.github.io/capybara/
https://github.com/teampoltergeist/poltergeist
http://phantomjs.org/
How to:
http://www.railsonmaui.com/tips/rails/capybara-phantomjs-poltergeist-rspec-rails-tips.html
https://github.com/teampoltergeist/poltergeist#installing-phantomjs
@emaraschio
emaraschio / gist:de459f573aef1617a5ce
Created November 28, 2014 22:37
Python Script: Transform JSON in CSV
#!/usr/bin/env python
import json
import csv
f = open('FILE.json')
data = json.load(f)
f.close()
f=csv.writer(open('FILE.csv','wb+'))
@emaraschio
emaraschio / jsconfar_2014.markdown
Last active April 30, 2017 17:10
My notes about JS Conf Arg 2014
@emaraschio
emaraschio / SOLID.markdown
Last active May 24, 2023 07:18
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

@emaraschio
emaraschio / player.rb
Last active June 1, 2017 20:52
Ruby Warrior Game
class Player
def play_turn(warrior)
@warrior = warrior
@health ||= warrior.health
@direction ||= :forward
warrior_feel = @warrior.feel @direction
if enemy_ahead?
@warrior.shoot!
elsif warrior_feel.empty?
@emaraschio
emaraschio / cache_query.rb
Last active August 29, 2015 14:14
Cache Rails Query
@results = Rails.cache.fetch "your_cache_key", :expires_in => 1.days do
#Do the query
end