Skip to content

Instantly share code, notes, and snippets.

View felquis's full-sized avatar
🔎
aligning divs with style

Felquis G felquis

🔎
aligning divs with style
View GitHub Profile
@felquis
felquis / sw.js
Created December 9, 2015 19:41
sw.js
/*
Copyright 2014 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
@felquis
felquis / f-throttle.js
Created November 30, 2015 18:41
fThrottle function in fJavaScript
// ref https://remysharp.com/2010/07/21/throttling-function-calls
function fThrottle(fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last,
deferTimer;
return function () {
var context = scope || this;
var now = +new Date,
args = arguments;
@felquis
felquis / finfinite-scroll.js
Last active November 30, 2015 18:41
fInfinite Scroll in fJavaScript language, just for fModern Browsers
// **
// Recurso de infinite scroll, deve ser usado apenas um por página
// uma página não deve ter mais que 2 chamadas de infinite scroll
(function infiniteScrollInit() {
var infiniteScrollCalled = false
function fInfiniteScroll(callback) {
// get fThrottle https://gist.github.com/felquis/299029971e40ad040b34
document.addEventListener('scroll', fThrottle(onScroll, 300))
@felquis
felquis / minimal-css-reset.css
Last active April 17, 2016 14:13 — forked from gpessia/minimal-css-reset.css
Minimal CSS Reset, resets margins, paddings and line-heights of every element needed, please adjust the selector below if you need paddings in lists
/**
Minimal CSS Reset
reset margins, paddings and line-heights of every element needed
if you need paddings into li, dl, dd elements, just remove them
from the selector below
Felquis Gimenes
MIT Licence
https://gist.github.com/felquis/1278d5f62dcc5f606bbb
@felquis
felquis / sdk.js
Created October 2, 2015 14:09
COPY and PASTE from connect.facebook.net/pt_BR/sdk.js to Sublime Text 3, Using Format JavaScript plugin.
/*1443789044,,JIT Construction: v1968057,pt_BR*/
/**
* Copyright Facebook Inc.
*
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*/
try {
window.FB || (function(window) {
@felquis
felquis / something.js
Last active September 7, 2015 04:10
The `undefined` kind of issue
/*
Return the same of `.get(index)` method,
but if the return of `.get` is undefined
this method will return an empty array `[]`
and NOT an `undefined`
Useful to make sure things wont break if
an element isn't in the DOM
*/
var getThat = function (index) {
@felquis
felquis / removeAllStyles.js
Last active September 7, 2015 03:38
Remove todos os estilos de uma página
var styles = document.querySelectorAll('link[rel="stylesheet"], style')
styles = nodeListToArray(styles)
function nodeListToArray(nodeList) {
return Array.prototype.slice.call(nodeList)
}
function removeNode(node) {
node.parentElement.removeChild(node)
}
@felquis
felquis / removeAllStyles.js
Created September 7, 2015 03:30
pt-BR: Remove todos os estilos de uma página
var styles = document.querySelectorAll('link[href$=".css"]')
styles = nodeListToArray(styles)
function nodeListToArray(nodeList) {
return Array.prototype.slice.call(nodeList)
}
function removeNode(node) {
node.parentElement.removeChild(node)
}
@felquis
felquis / file.js
Created September 2, 2015 16:38
I found a minified JavaScript file on the internet and I decided to re-format the whole code to a human-like code, but I got into the following doubt
// I figured out this function looks like RequireJS's `define` function
// but I couldn't find a source or resource to help me understand this code
// I'll appreciate some help, links to clearly docs
// NOTE: I'm not interested in how RequireJS works, cause it's source code is huge,
// I just want to understand how the code bellow works. Maybe the source above documented
//
//
// I think it's a output file from browserify or some tool like that
function define(modules, n, r) {
shell: {
facebookDownload: {
command: [
'echo "## Downloading Facebook Plugin"',
'git clone git@github.com:Wizcorp/phonegap-facebook-plugin.git .tmp-plugin/phonegap-facebook-plugin/',
'cd .tmp-plugin/phonegap-facebook-plugin/',
'echo "## Checkout tag v0.11.0"',
'git checkout v0.11.0 -q',
'cd ./../../'