Skip to content

Instantly share code, notes, and snippets.

@guiprav
guiprav / SketchSystems.spec
Last active August 15, 2018 07:04
Aguardando invites
Aguardando invites
recebeu invite enquanto online -> Tratando invite
recebeu invite enquanto offline -> Aguardando mudança de estado
Aguardando mudança de estado
fim da transição -> Tratando invite
Tratando invite
disponível ou em preview - adiciona à fila -> Verifica fila
do contrário -rejeita -> Aguardando invites
Loop
fila tem algum invite - processa -> Após processamento de invite
fila está vazia -> Fim do processamento
Após processamento de invite
agente ainda pode receber chamadas - remove da fila -> Loop
agente não pode mais receber chamadas - limpa a fila -> Fim do processamento
Fim do processamento
processamento reiniciado -> Loop
@guiprav
guiprav / tryfinallydolly.js
Last active August 8, 2018 03:47
Use finally sim
function transfereDollares(de, para, quantos) {
let pegouError = false;
try {
// [...] (codigos com retorne)
} catch (err) {
pegouError = true;
throw err;
} finally {
if (pegouError) {
@guiprav
guiprav / SketchSystems.spec
Last active July 24, 2018 21:46
StdTable com fetch extensions
StdTable com fetch extensions
Inicialização*
caso não tenha fetch-fn -> Comportamento original
caso tenha fetch-fn -> Carregar itens
Comportamento original
ao mudar filtros -> Comportamento original
ao mudar ordenamento -> Comportamento original
ao mudar página -> Comportamento original
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtQ465qHRHBZmsD/PeyQCVlqSP1OsCHFXbxhmbZNchNCZc2JEh3D5wKH2aQhHjvvdGFGeUuGn3Kr0EYIHesgaQtaxhLUCyIz7TaAqCghq0s90VFPs159K02JLJ8iG1tDzwRzodcWZUDlyIUHVKukqqTGprBXrsxGdH9thjH7M6Fm+5+yCg0CFJf6oYAGuwrolKaEyxyU0hEkPGgbjzAIHbTDAYA4X+gXXFdIkJ6kiBvUNSASvDUBRlScrWaWht/QwrA5j5LUDaJzDEcNBqF5rBJ1CIlxvQVB2tQU4/pUm1yAfX72RulHse2MF+GDqqBOyGbDULBpG68BqO5reejY3p guilherme@tokyo-2
$.fn.checkboxChildrenSelect = function() {
var $outermost = $(this);
function update() {
$outermost.find('.checkbox_children_select.group-label').each(function() {
var $checkedLeaves = $(this)
.closest('ul')
.find(':not(.group-label):checked');
$(this).prop('checked', $checkedLeaves.length !== 0);
// https://github.com/n2liquid/shift-builder/blob/master/test.js
let n = require('./node_builders');
let compile_fn = require('./compile_fn');
let n_factorial = n.fn_expr('factorial', ['n'], [
n.if_stmt(n.binary_expr('===', [
n.id('n'), n.num(0),
]), [
n.return_stmt(n.num(1)),
@guiprav
guiprav / sms.md
Last active August 15, 2017 02:33

I've been using Amazon SNS for sending transactional SMS messages for the past 6 months and had lots of problems with delays and delivery failures for Brazilian phone numbers.

I've seen other people having similar problems months ago and Amazon never answered them on their support forum, so I'm now looking for better alternatives.

Problem is, time's really short, and we can't be testing services for comparison; I have to pick one and deploy it, and it "has to work." Twilio seems like a really good pick, but I was also asked to try to find a cheaper one if possible...

So, is there a transactional SMS sending service that's able to send messages internationally, but which is also known to have best-in-class deliverability in Brazilian territory?

Looking for suggestions from people who had those same needs, who have successfully deployed apps using a given service, and who have seen it work flawlessly in practice.

deb http://ftp.br.debian.org/debian/ unstable main
deb-src http://ftp.br.debian.org/debian/ unstable main
deb http://security.debian.org/ unstable/updates main
deb-src http://security.debian.org/ unstable/updates main
# unstable-updates, previously known as 'volatile'
deb http://ftp.br.debian.org/debian/ unstable-updates main
deb-src http://ftp.br.debian.org/debian/ unstable-updates main
@guiprav
guiprav / index.js
Last active August 29, 2016 19:44
requirebin sketch
var formurlencoded = require('form-urlencoded');
var obj = {
contactInfo: [
{ type: 'email', value: 'example1', business: 1 },
{ type: 'phone', value: 'example2' },
],
};
document.write(decodeURIComponent(formurlencoded(obj)));