Skip to content

Instantly share code, notes, and snippets.

View horacioibrahim's full-sized avatar

Horacio Ibrahim horacioibrahim

View GitHub Profile
@horacioibrahim
horacioibrahim / anaoRenderizador.js
Created May 8, 2016 14:29
Utilizado para definir a largura de elementos de uma lista baseado em uma largura dinâmica
anaoRenderer: function() {
var h = this.containerHeight;
var w = this.containerWidth;
var workWidth = Math.trunc(w*0.95);
var workHeight = h - 128; // botton height of button actions + margin-left.
var faceBoxWidth = Math.trunc(workWidth / 4);
var classCenter = this.querySelector('.center');
var imgList = this.querySelectorAll('.face-box img');
var faceboxList = document.querySelectorAll('.face-box');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
@horacioibrahim
horacioibrahim / renderbox.html
Last active June 14, 2016 17:34
Renderizar boxes
<!DOCTYPE html>
<html lang="en">
<head>
<!-- basics needs -->
<meta charset="utf-8">
<title>Link: </title>
<meta name="description" content="Engajamento entre nós da rede. Tudo são nós!">
<meta name="author" content="horacio ibrahim <horacoibrahim_at_gmail.com">
<!-- Mobile specs -->
<html>
<head>
<style>
* {
margin:0;
padding:0;
font-family:"Helvetica Neue", Helvetica, Sans-serif;
word-spacing:-2px;
}
h1 {
var pairs = [];
var iterate = function(data){
var userKey = data.key; // delete this after loop
var values = data.val();
var listTIDByUser = Object.keys(values);
// fazer loop aqui
for (var t = 0; t < listTIDByUser.length; t++){
var tid = listTIDByUser[t];
console.log("TID: " + tid);
console.log(values[tid]);
lista = [];
ref = firebase.database().ref('users/');
ref.on('child_added', function(res){lista.push(res.val())});
ACCOUNTS = {
"-KS1cW3msDwUbv0d58vJ": "888Poker",
"-KS1c-I3_T_PN6fQIUic": "Bet365",
"-KS1chNYO-1PEPL-XBeS": "PartyPoker",
"-KS1dtmyU8gMlEBW7svL": "Neteller",
"-KSESOkKPIUgx8YaBw2y": "PokerStars"
};
@horacioibrahim
horacioibrahim / convert_json_csv.py
Last active December 4, 2016 18:57
Converts JSON to CSV
#!/bin/python
# -*- coding: utf-8 -*-
"""
Converts JSON to CSV.
"""
import json
import csv
firebase.database().ref('transactions/').push(data).then(function(res){ // PUSH 1
firebase.database().ref('users/' + user.uid + '/transactions/' + res.key).set({dtCreated: data.dtCreated}).then(
function(res2){ // AFTER PUSH 2
console.log("Gravou nos 2");
window.location.href = "#/dashboard/history";
}, function(err2) {
var error = {
canceled: true,
log: "transaction not registered in owner attributes."
};
// get current points
var pointsRef = firebase.database().ref("lives/" + liveid + '/data/' + page);
pointsRef.on("child_added", function(res){
var model = res.val();
if (model === null) {
console.log("model is: " + ms);
} else {
console.log("**************");
var keys = Object.keys(model);
for (var k = 0; k < keys.length; k++) {
@horacioibrahim
horacioibrahim / fabricBezierCurve.js
Created December 8, 2016 20:37 — forked from paulkaplan/fabricBezierCurve.js
Cubic bezier curves with fabric.js renderer
var CubicBezier = function(canvas, opts){
if(!opts) opts = {};
this.start = opts.start || new Vec2(100,100);
this.end = opts.end || new Vec2(400, 400);
this.c1 = opts.c1 || new Vec2(100, 300);
this.c2 = opts.c2 || new Vec2(300, 100);
this.curve = new fabric.Path( this.toSVGPath() );