Skip to content

Instantly share code, notes, and snippets.

View lfreneda's full-sized avatar
💙
Always deliver more than expected.

Luiz Freneda lfreneda

💙
Always deliver more than expected.
View GitHub Profile
@lfreneda
lfreneda / integrations-curls-calls.sh
Created November 29, 2017 10:53
integrations-curls-calls.sh
```
curl 'http://api.fieldcontrol.com.br/orders/' -H 'Content-Type: application/json;charset=UTF-8' -H 'x-access-token: seu-token-aqui' --data-binary $'{
"address": {
"zipCode": "05005900",
"city": "Sao Paulo",
"state": "SP",
"street": "Rua Turiassu",
"number": "902",
"complement": null,
"neighborhood": null,
@lfreneda
lfreneda / collapse.js
Last active September 6, 2017 13:17 — forked from dmfay/collapse.js
Collapse JOIN query result sets into a hierarchical object graph
'use strict';
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchStr, Position) {
// This works much better than >= because
// it compensates for NaN:
if (!(Position < this.length))
Position = this.length;
else
Position |= 0; // round position
@lfreneda
lfreneda / web-security-checklist.md
Last active July 24, 2017 18:10
web-security-checklist.md
@lfreneda
lfreneda / q.sql
Created January 30, 2017 01:09
Using Postgres JSON Functions to Map Relational Data to JSON
select row_to_json(tasks) as tasks
from (
select
id
from
tasks
where id = '71bb6799-da97-45e3-98eb-db1b14e4b79d'
) as tasks;
@lfreneda
lfreneda / google-maps-json-style-to-google-maps-static-url-parameter.js
Created November 12, 2016 13:23
google maps json style to google maps static url parameter
function get_static_style(styles) {
var result = [];
styles.forEach(function(v, i, a){
var style='';
if (v.stylers.length > 0) { // Needs to have a style rule to be valid.
style += (v.hasOwnProperty('featureType') ? 'feature:' + v.featureType : 'feature:all') + '|';
style += (v.hasOwnProperty('elementType') ? 'element:' + v.elementType : 'element:all') + '|';
v.stylers.forEach(function(val, i, a){
var propertyname = Object.keys(val)[0];
var propertyval = val[propertyname].toString().replace('#', '0x');
@lfreneda
lfreneda / moment-timezone names
Created October 16, 2016 11:18
moment-timezone names
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@lfreneda
lfreneda / gist:62db7e91b0fb3c576b74afaf8cbba6ab
Created June 13, 2016 14:46
Http Offline Cache Ionic Module with Lokijs
(function () {
'use strict';
angular.module('app.offline')
.factory('httpOfflineCacheStorage', httpOfflineCacheStorage);
function httpOfflineCacheStorage(Loki) {
var _cacheDb = null;
var _requests = null;
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
var _ = require('underscore')._;
var Task = (function() {
function Task(description) {
this.id = 1;
this.description = description;
}
Task.prototype.reportAsProblem = function(problemDescription) {
this.problemDescription = problemDescription;
@lfreneda
lfreneda / genymotionwithplay.txt
Created February 1, 2016 17:02 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)