Skip to content

Instantly share code, notes, and snippets.

😃
Coding

Alejandro Garcia Anglada aganglada

😃
Coding
Block or report user

Report or block aganglada

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
View intersection-observer-polyfill.js
loadPolyfills()
.then(() => /* Render React application now that your Polyfills are ready */)
/**
* Do feature detection, to figure out which polyfills needs to be imported.
**/
function loadPolyfills() {
const polyfills = []
if (!supportsIntersectionObserver()) {
View create-image.js
const img = new Image()
img.src = this.props.src
img.onload = this.onLoadImage
img.onerror = this.onLoadImageError
@aganglada
aganglada / intersection-observer.js
Last active Sep 21, 2017
Intersection Observer
View intersection-observer.js
if (!this.props.observeOnScroll) {
return false
}
this.observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
const { isIntersecting, intersectionRatio } = entry
if (isIntersecting === true || intersectionRatio > 0) {
this.createImage()
@aganglada
aganglada / script-cache.js
Created Feb 24, 2017
Script Cache Promise based
View script-cache.js
let counter = 0;
let scriptMap = new Map();
export const ScriptCache = (function(global) {
return function ScriptCache (scripts) {
const Cache = {};
Cache._onLoad = function(key) {
return (cb) => {
let stored = scriptMap.get(key);
@aganglada
aganglada / casper2php.js
Created Aug 10, 2015
Execute php script from casperjs
View casper2php.js
var casp = require('casper').create({
verbose: true,
logLevel: 'debug'
});
casp.start().then(function() {
var finished = false;
var cp = require('child_process');
cp.execFile('/usr/bin/php','test.php', {},function(_,stdout,stderr){
console.log(stdout);
@aganglada
aganglada / Angular+Webpack
Last active Aug 29, 2015
Angular + Webpack
View Angular+Webpack
Web components are arguably the Way Of The Future, they provide reusability of code and encapsulation of logic with the view.
Angular allows us to create native looking web components with directives, but also allows standalone controllers to be made.
Doing things this way helps future-proof our app by forcing us to structure our app like we were using native web components already.
@aganglada
aganglada / Prueba
Created Jan 30, 2012
Gist de prueba
View Prueba
Esto es un gist de prueba
You can’t perform that action at this time.