Skip to content

Instantly share code, notes, and snippets.

View gist:751
class RegisterMail < ActionMailer::Base
def send_mail(client_email, username)
subject "Someone have signed up."
recipients "#{client_email}"
from 'test@test.com'
charset "utf-8"
content_type 'text/html'
body "#{username}" + "have been signed up."
end
end
@cv
cv / git-histogram.sh
Created Jul 22, 2008
Runs a script for every commit in a git repository
View git-histogram.sh
moved to http://github.com/cv/git-utils :)
View gist:2670
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Base Page</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
<style type="text/css" media="screen" >
* { padding:0; margin: 0; font-family: helvetica;}
body { background: margin:1em; padding:0; }
@cv
cv / array-listeners.js
Created Jan 12, 2015
array-listeners.js
View array-listeners.js
Array.prototype.addEventListener = function(fn, cb) {
if(!this.__eventListeners) {
this.__eventListeners = {};
}
if(typeof(fn) !== 'string') {
throw "Can't add event listener: 1st argument is not a string";
}
if(typeof(cb) !== 'function') {
View rails-new-xml-http-response
[cv@bacon ~]$ curl -i http://localhost:3000/passport_applications/new.xml
HTTP/1.1 200 OK
Connection: close
Date: Thu, 31 Jul 2008 01:52:51 GMT
Set-Cookie: _webdocs_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--859666d5b96dd9ae67722dc0c8f410d3b6b365b6; path=/
Status: 200 OK
X-Runtime: 0.00808
ETag: "5f8af8da6299af5a000c21dc2a796e46"
Cache-Control: private, max-age=0, must-revalidate
Server: Mongrel 1.1.5
View passport_applications_controller.rb
# GET /passport_applications/new
# GET /passport_applications/new.xml
def new
@passport_application = PassportApplication.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @passport_application }
end
end
View form-with-uuid.xml
<?xml version="1.0" encoding="UTF-8"?>
<passport-application>
<uuid>09711c30-40d5-012b-3f7b-001ec212da96</uuid>
<full-name nil="true"></full-name>
<address nil="true"></address>
<...>
</passport-application>
@cv
cv / auxílio-doença.xml
Created Feb 17, 2015
Exemplo de XML de serviço (legado)
View auxílio-doença.xml
<?xml version="1.0" encoding="UTF-8"?>
<servico>
<titulo>Auxílio-Doença</titulo>
<descricao>Benefício concedido ao segurado impedido de trabalhar por doença ou acidente por mais de 15 dias
consecutivos. No caso dos trabalhadores com carteira assinada, os primeiros 15 dias são pagos pelo empregador,
exceto o doméstico, e a Previdência Social paga a partir do 16º dia de afastamento do trabalho. Para os demais
segurados inclusive o doméstico, a Previdência paga o auxílio desde o início da incapacidade e enquanto a mesma
perdurar.
</descricao>
<requisitos></requisitos>
@cv
cv / leela.txt
Created Apr 14, 2015
My cat's first commit
View leela.txt
33333333333333eeeeee```wrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryyy22222222fffffffff5u5555555555555uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuUUUU$$$$$$1111111ssssssssssssssssffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfffffffffffffffaaaaaaaaaaaaaaaaafffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 99999999999999999999999999999999999999999999999999999989888897777777777777777777777773333333333333333bbbbbbb9~9~9~9~dddddddddddddddddddddddddddddddddddddddqqqqqqqqqqqqqqq4444444444444aaa11111111111111111111111111111111111111111111111111111111111111111111111raaaaaaaaa444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
@cv
cv / .gitignore
Created Sep 17, 2008
Spits out a lexicon-like txt file from a wikipedia dump