Skip to content

Instantly share code, notes, and snippets.

View fnando's full-sized avatar

Nando Vieira fnando

View GitHub Profile
Missing template C:/Ruby192/lib/ruby/gems/1.9.1/gems/pagseguro-0.1.9/lib/pagseguro/views/_form.html with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "C:/Users/fnando/Desktop/ps/app/views", "C:/Users/fnando/Desktop/ps", "C:/"
@fnando
fnando / certificate.rb
Created April 15, 2011 00:41
Create PDF using Prawn
require "prawn"
class Certificate
attr_accessor :path
PDF_OPTIONS = {
:page_size => "A5",
:page_layout => :landscape,
# :background => "public/images/cert_bg.png",
:margin => [40, 75]
Prezado cliente PlayStation Network/Qriocity:
Recentemente descobrimos que, entre 17 de abril e 19 de abril de 2011,
as informações de determinadas contas de usuário do serviço PlayStation
Network e Qriocity foram comprometidas devido a uma intrusão de caráter
ilegal e não autorizado em nossa rede. Reagimos a essa intrusão com as seguintes ações:
1) Desativamos temporariamente os serviços da PlayStation Network e Qriocity;
2) Contratamos uma reconhecida empresa independente de segurança para
@fnando
fnando / rubygems_proxy.rb
Created April 28, 2011 22:54
Rack app for caching RubyGems files. Very useful in our build server that sometimes fails due to our network or rubygems.org timeout.
# Moved to its own repo: http://github.com/fnando/rubygems_proxy
@fnando
fnando / debug.css
Created April 29, 2011 11:09
Debug HTML using a modified version of holmes.css
/**
* This file was taken from http://www.red-root.com/sandbox/holmes/
* and adapted to remove some annoying warnings that I really don't care about.
* Also removed .holmes-debug namespace, so I can just include stylesheet as following.
*
* <%= stylesheet_link_tag "debug" if Rails.env.development? %>
*
* ------------------------
*
* Debug colours and what they mean
# -*- encoding: utf-8 -*-
class Certificate < Base
class PDF
PDF_OPTIONS = {
:page_size => "A5",
:page_layout => :landscape,
:background => Rails.root.join("public/images/certificate/bg.png"),
:margin => [30, 70]
}
@fnando
fnando / block.rb
Created June 8, 2011 23:12
Switch block's context and yield variable. At the same time. How would you do it?
object = Object.new
block = proc do |var|
puts "var: #{var.inspect}" #=> should be :a => 1
puts "self: #{self.inspect}" #=> should be object variable
end
block.call :a => 1
@fnando
fnando / config.ru
Created June 23, 2011 15:07
Rack API with catch-all route
require "rack/api"
Rack::API.app do
prefix "/"
get "users" do
[]
end
get "/api(/*catch_all)" do
@fnando
fnando / strftime.js
Created June 25, 2011 12:27
Date.strftime for JavaScript (Extracted from http://github.com/fnando/i18n-js)
Date.prototype.strftime = function(format) {
var options = {
"day_names": ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
"abbr_day_names": ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
"month_names": [null,"January","February","March","April","May","June","July","August","September","October","November","December"],
"abbr_month_names": [null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
}
var date = this;
@fnando
fnando / scraping.js
Created June 25, 2011 14:20
Scraping using Node.js and jQuery
var url = require("url")
, http = require("http")
, $ = require("jquery")
, uri = url.parse("http://simplesideias.com.br")
, html = ""
;
http.request(uri, function(response){
response.on("data", function(data){
html += data;