Skip to content

Instantly share code, notes, and snippets.

Felquis Gimenes felquis

Block or report user

Report or block felquis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
felquis / average.js
Created Jun 17, 2017
Take the average number of a x list of numbers in a sequence
View average.js
export default function average (limit) {
let list = []
let current = 0
return (x) => {
list = [...list, x]
if (list.length < limit) return current
current = list.reduce((acc, x, index) => {
felquis / estimate-reading-time.js
Last active Mar 18, 2017
How much time would I take to read a web page?
View estimate-reading-time.js
// output is in minutes
document.body.innerText.split(' ')
.filter((split) => split.length > 1)
.map((split) => split.replace(/[^a-zZ-a]+/g, ''))
.filter((split) => split.length > 1)
.reduce((acc, split) => {
const time = split.split('').length * 115
return [...acc, (time > 500) ? time : 500]
}, [])
.reduce((acc, time) => ([acc[0] + time]), [0])
View index.js
fetch('', { method: 'get' })
.then(response => response.json())
View index.js
const cep = require(‘cep-promise’)
felquis / index.js
Last active Jan 21, 2017
Promise chain mutating Object with setTimeout, + fixing with R.merge
View index.js
// Test 1, what will be displayed in the logs?
.then(() => {
const car = {
color: 'Green'
setTimeout(() => {
car.color = 'Orange'
}, 0)
felquis / data.js
Last active Jul 12, 2016
How many times a word in bold is mentioned in the AngularJS CHANGELOG?
View data.js
(function () {
'use strict' = `<a name="1.5.7"></a># 1.5.7 hexagonal-circumvolution (2016-06-15)## Bug Fixes- **$compile:** - don't add merged attributes twice to $attrs ([ebbaa4ac](, [#8159](, [#14737]( - cope with $onChanges hooks throwing ([3749c858](, [#14444](, [#14463]( **$parse:** allow arguments to contain filter chains ([cc6dcb4b](, [#4175](, [#4168](, [#14720]( **$ro
felquis / gist:1261abef589af89f1114
Created Mar 11, 2016
Truly Global Unique Identifier generator for Web Apps using Crypto API, with fallback to pseudo random numbers Math.random
View gist:1261abef589af89f1114
Cria um Globally Unique Identifier randomico
para uso junto ao Google Measurement Protocol
A discussão sobre isso é grande e eu cansei de ler
o lance é o seguinte, usamos `window.crypto` quando disponível
quando não disponível (browsers antigos) usamos o Math.random
que não é la grandes coisas, mas mesmo assim já é TOP!
Resposta no Stackoverflow
+ minhas adaptações

Windows Phone Lumia 640

Internet Explorer

Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; RM-1109) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537
felquis / example.js
Created Jan 27, 2016
Service Worker: Ignore request endpoints with RegEx
View example.js
// This polyfill provides Cache.add(), Cache.addAll(), and CacheStorage.match(),
// which are not implemented in Chrome 40.
importScripts('js/cache-polyfill.js') // find it on the internet
var version = 'v01234567'
var ignoreRequests = new RegExp('(' + [
'\.com/', // customize to your use case, home page
'/perfil\/(.*)', // ignore also IDs
felquis /
Last active Aug 22, 2019
iOS, Android browser apps URL Schemes to handle URL between browsers, and apps..

Assume your Client is on iOS Safari, but you want it to open a URL on Chrome, Firefox or Opera... How do you do that? Or assume your Client is on Chrome, but a third party doens't support Chrome, so you need to link your client to Safari, how do you achieve that?


To open on Chrome

<a href="googlechrome://">try it on Chrome</a>

check out Chrome iOS Docs for more information

You can’t perform that action at this time.