Skip to content

Instantly share code, notes, and snippets.

View Nosfheratu's full-sized avatar
🏠
Working from home

Fernando Serapio Nosfheratu

🏠
Working from home
View GitHub Profile
@Nosfheratu
Nosfheratu / pokemonGS-time-reset.js
Last active May 12, 2019 08:33
Reset time in Pokemon G/S games
console.log('---');
// logic via: http://www.gamefaqs.com/gbc/446340-pokemon-silver-version/faqs/12550
// and http://upokecenter.dreamhosters.com/articles/pokemon-video-games/pokemon-gold-and-silver/changing-the-time-in-pokemon-gold-and-silver/#How_the_Game_Calculates_the_Password
function $(id) {
return document.getElementById(id);
}
function generatePassword() {
@Nosfheratu
Nosfheratu / my_mailer.rb
Created January 18, 2019 04:22
send pdf attachment
class MyMailer < ApplicationMailer
def send_invoice user, invoice
@user = user
@invoice = invoice
invoice_attachment = WickedPdf.new.pdf_from_string(render_to_string(pdf: "invoice", template: 'payments/charges/invoice.pdf.erb'))
attachments["I#{sprintf('%06d', @invoice.id)}.pdf"] = invoice_attachment
mail(to: @user.email,
subject: "Your invoice", template_path: 'users_mailer')
end
end
@Nosfheratu
Nosfheratu / 42-things.md
Created October 19, 2018 21:15 — forked from xdite/42-things.md
Ten (42) Things You Didn't Know Rails Could Do
require 'prime'
primes = []
number_to_compute = 999999999
while true do
number_to_compute += 1
primes << number_to_compute if number_to_compute.prime?
break if primes.size == 2
end
@Nosfheratu
Nosfheratu / schedule.rb
Created April 2, 2016 02:38 — forked from mdesantis/schedule.rb
Schedule script for using Whenever toghether with rbenv
# Schedule script for using Whenever toghether with rbenv
#
# Whenever: https://github.com/javan/whenever
# rbenv: https://github.com/sstephenson/rbenv
set :env_path, '"$HOME/.rbenv/shims":"$HOME/.rbenv/bin"'
# doesn't need modifications
# job_type :command, ":task :output"
@Nosfheratu
Nosfheratu / Rakefile
Created September 7, 2015 01:57
change rubymotion android api level & use Genymotion emulator
# http://www.iconoclastlabs.com/blog/rubymotion-android-in-the-emulator-with-genymotion
app.api_version = "22"
app.archs << 'x86' # for Genymotion support
@Nosfheratu
Nosfheratu / zsh.md
Last active April 9, 2016 00:09 — forked from tsabat/zsh.md
@Nosfheratu
Nosfheratu / rails_ubuntu_setup
Created January 16, 2015 16:01
Simple RoR environment setup
sudo apt-get update
sudo apt-get install curl git-core python-software-properties
sudo apt-get install build-essential
sudo apt-get install imagemagick libmagickwand-dev
# PostgreSQL
# sudo add-apt-repository ppa:pitti/postgresql
# sudo apt-get update
# sudo apt-get install postgresql libpq-dev
sudo apt-get install postgresql-9.3 libpq-dev
# SQLite3
upstream unicorn {
server unix:/tmp/unicorn.my_app.sock fail_timeout=0;
}
server {
server_name my_app.com www.my_app.com;
listen 80 default deferred;
root /home/deployer/webapps/node/my_app/public;
@Nosfheratu
Nosfheratu / ruby_development_environment
Last active August 25, 2020 10:03
simple environment setup for ruby/rails development
sudo apt-get update
sudo apt-get install curl git-core software-properties-common
sudo apt-get install build-essential
sudo apt-get install imagemagick libmagickwand-dev
# PostgreSQL
sudo apt-get install postgresql-9.3 libpq-dev
# SQLite3
sudo apt-get install sqlite3 libsqlite3-dev