Skip to content

Instantly share code, notes, and snippets.

View gabrielengel's full-sized avatar

Gabriel Engel gabrielengel

View GitHub Profile
@gabrielengel
gabrielengel / passports_regexp.rb
Created September 21, 2020 18:14
Regular Expressions for passports
passports = {
_generic: /^(\b([A-Za-z]\s*){1,2}\s*(\d\s*){7})/,
austria: /^[A-z] ?[0-9]{7}$/,
belgium: /^[A-z]{2}[0-9]{6}$/,
bulgaria: /^[0-9]{9}$/,
croatia: /^[0-9]{9}$/,
cyprus: /^[A-z][0-9]{6,8}$/,
czech: /^[0-9]{8}$/,
denmark: /^[0-9]{9}$/,
estonia: /^[A-z][0-9]{7}$/,
@gabrielengel
gabrielengel / bancos_brasil.json
Last active January 31, 2019 21:20
bancos do brasil
[
"001 - Banco do Brasil",
"003 - Banco da Amazônia",
"004 - Banco do Nordeste",
"021 - Banestes",
"025 - Banco Alfa",
"027 - Besc",
"029 - Banerj",
"031 - Banco Beg",
"033 - Banco Santander Banespa",
@gabrielengel
gabrielengel / edit.html
Created April 27, 2015 20:00
Edit CSS Here
<a href='javascript:el=document.createElement("style");el.style.display="block";el.style.position="absolute";el.style.bottom="0";el.style.right="0";el.style.left="0";el.style.background="#fff";el.contentEditable=true;el.innerHTML="body{background: lightgreen;}";document.body.appendChild(el);event.preventDefault();'>
Edit CSS
</a>
@gabrielengel
gabrielengel / ruby-gmail.md
Created August 9, 2014 14:31
New Ruby-Gmail Interface

Require gmail

require 'gmail'

Start an authenticated gmail session

Gmail.new(username, password) do |gmail|
  # ...do things...
end
window.Timer = {
countdown: function(minutes,seconds){
var currentTime = new Date().getTime();
Timer.finishTime = currentTime + (minutes * 60 * 1000) + (seconds * 1000);
Timer.running = setInterval("Timer.ended()",1000)
},
ended: function(){
var currentTime = new Date().getTime();
console.log('Now: ' + currentTime + ' - ends: ' + Timer.finishTime);
// Editor specific listener
editor.on("aftercommand:composer", resize); // Set bold, italic, etc
editor.on("change_view", resize); // Change wysi/source view
// Typing listeners
editor.on("newword:composer", resize); // Only way to observe on firefox
editor.on("undo:composer", resize);
editor.on("paste", resize);
iframeBody.addEventListener('keyup', resize, false);
iframeBody.addEventListener("keydown", resize, false);
/**
* @license wysihtml5 v0.4.0pre
* https://github.com/xing/wysihtml5
*
* Author: Christopher Blum (https://github.com/tiff)
*
* Copyright (C) 2012 XING AG
* Licensed under the MIT license (MIT)
*
*/
/*
wysihtml5 v0.4.0pre + autoresize On Chrome
https://github.com/xing/wysihtml5
Author: Christopher Blum (https://github.com/tiff)
Copyright (C) 2012 XING AG
Licensed under the MIT license (MIT)
Rangy, a cross-browser JavaScript range and selection library
@gabrielengel
gabrielengel / symbol_array.rb
Created November 15, 2012 14:02
Get Symbol Array from a String
def symbol_array_from_string(value)
regex = /\[((:([^ ,\]])+) *,{0,1} *)+\]/
return value unless value =~ regex
value.scan(/:[^ ,\]]+/).map{|v| v.gsub(/^:/,'').to_sym}
end
result = symbol_array_from_string("[:a, :apple,:dog]")
result == [:a, :apple, :dog]
@gabrielengel
gabrielengel / start_server.sh
Created May 25, 2012 05:43
Install Nginx, Unicorn & ruby 1.9.3
#!/usr/bin/env bash
# Setup a ubuntu 12.04 LTS machine with nginx, unicorn, ruby 1.9.3
# RUN: curl -L http://goo.gl/M8SXl | bash
mkdir ~/server ; cd ~/server
wget https://github.com/gabrielengel/chef-ubuntu/tarball/master
tar -zxf master
cd gab*
mv dna.aws-sample.json dna.json