Skip to content

Instantly share code, notes, and snippets.

Antón Molleda molant

Block or report user

Report or block molant

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 logo-filelinx.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@molant
molant / gist:9772070
Created Mar 25, 2014
AngularJS watchers in page
View gist:9772070
(function () {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) {
watchers.push(watcher);
});
}
@molant
molant / bugrepro.js
Created Apr 29, 2013
Problem with cookie handling and some websites
View bugrepro.js
"use strict";
var request = require('request'),
request = request.defaults({
// jar: false,
headers: {
'Accept': 'text/html, application/xhtml+xml, */*',
'Accept-Language': 'en-US,en;q=0.5',
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)'}}),
websites = ['http://cnet.com',
@molant
molant / gameloop-videoediting.js
Created Mar 10, 2013
Game Loop example for video editing project
View gameloop-videoediting.js
function tick(){
//we clean if we've changed the size of the quadrant
if(needsClean){
cleanCanvas();
}
//if we have to change the quadrant's frame because we are the active one (or the opposite)
if(newFrame){
drawFrame(); //we draw just the frame in a separate canvas so it doesn't need to be calculated all the time, and it is still faster than copying from an image
}
@molant
molant / uievents-raf.js
Last active Dec 14, 2015
How to process UI events with RAF
View uievents-raf.js
var deltaX = 0,
queued = false;
function myAction(){
//your awesome code here uses deltaX
deltaX = 0; //we reset the deltaX so it can be incremented next time onEvent is executed
queued = false;
}
function onEvent(evt){
You can’t perform that action at this time.