Skip to content

Instantly share code, notes, and snippets.

View mateusdelbianco's full-sized avatar

Mateus Del Bianco mateusdelbianco

View GitHub Profile
@everton
everton / Bhaskara
Created April 6, 2011 13:45
Weird way to say Bhaskara in Ruby (or "((-b).± √ Δ(a, b, c))" / (2 * a) as a valid Ruby expression)
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
def √(n)
Math::sqrt(n)
end
class Numeric
def ±(n)
r = [self + n, self - n]
@ryanmarshall
ryanmarshall / gist:989900
Created May 24, 2011 22:29
Quick Ruby Signed Request Parser for Facebook
module Facebook
#
# Facebook request tools
#
class Request
class << self
def parse_signed_request(signed_request, secret, max_age=3600)
encoded_sig, encoded_envelope = signed_request.split('.', 2)
envelope = JSON.parse(base64_url_decode(encoded_envelope))
algorithm = envelope['algorithm']
pt-BR:
devise:
confirmations:
confirmed: "Sua conta foi confirmada com sucesso. Você está logado."
send_instructions: "Dentro de minutos você receberá um e-mail com instruções para confirmar a sua conta."
send_paranoid_instructions: "Caso seu e-mail exista em nossa base, você receberá um e-mail em poucos minutos com instruções sobre como confirmar sua conta."
failure:
already_authenticated: "Você já está logado."
inactive: "A sua conta não foi ativada ainda."
invalid: "E-mail ou senha inválidos."
@mAAdhaTTah
mAAdhaTTah / 1_netatalk-3-install-on-ubuntu-14.04.sh
Last active December 11, 2019 16:20 — forked from beshkenadze/1_netatalk-3-install-on-debian-7
Shell script to install Netatalk 3 on Ubuntu 14.04
# Get root:
sudo su
# Install prerequisites:
apt-get install build-essential pkg-config checkinstall git avahi-daemon libavahi-client-dev libcrack2-dev libwrap0-dev autotools-dev automake libtool libdb-dev libacl1-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev
# Build libevent from source:
cd /usr/local/src
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/