Skip to content

Instantly share code, notes, and snippets.

Avatar
💙
Always deliver more than expected.

Luiz Freneda lfreneda

💙
Always deliver more than expected.
View GitHub Profile
@lfreneda
lfreneda / q.sql
Created Jan 30, 2017
Using Postgres JSON Functions to Map Relational Data to JSON
View q.sql
select row_to_json(tasks) as tasks
from (
select
id
from
tasks
where id = '71bb6799-da97-45e3-98eb-db1b14e4b79d'
) as tasks;
@lfreneda
lfreneda / index.js
Last active Feb 14, 2020
Field Control API
View index.js
(function() { window.location = 'https://developers.fieldcontrol.com.br/#api-field-control'; })();
@lfreneda
lfreneda / google-maps-json-style-to-google-maps-static-url-parameter.js
Created Nov 12, 2016
google maps json style to google maps static url parameter
View google-maps-json-style-to-google-maps-static-url-parameter.js
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');
View 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 / instagram auto follow
Last active May 16, 2019
instagram auto follow
View instagram auto follow
var index = 0;
var buttons = null;
var scrollCount = 0;
var followedCount = 0;
function clickAndWait() {
if (buttons === null) {
buttons = document.querySelectorAll('li button');
}
@lfreneda
lfreneda / gist:62db7e91b0fb3c576b74afaf8cbba6ab
Created Jun 13, 2016
Http Offline Cache Ionic Module with Lokijs
View gist:62db7e91b0fb3c576b74afaf8cbba6ab
(function () {
'use strict';
angular.module('app.offline')
.factory('httpOfflineCacheStorage', httpOfflineCacheStorage);
function httpOfflineCacheStorage(Loki) {
var _cacheDb = null;
var _requests = null;
View 1-restify-server-cheatsheet.js
// 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');
View gist:1100ecfedf7a2bec7cc527a0b0bde69c
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 Feb 1, 2016 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
View genymotionwithplay.txt
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)
View extract-emails.sh
#!/usr/bin/env bash
if [ -f "$1" ]; then
strings "$1" | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | sort | uniq -i > emails_"$1"
else
echo "Expected a file at $1, but it doesn't exist." >&2
exit 1
fi