Skip to content

Instantly share code, notes, and snippets.

View victornpb's full-sized avatar
⌨️

Victor victornpb

⌨️
View GitHub Profile
/**
* Recursively extend the base object or override it with properties from the extesion object
* @param {Object} base The base object that will be modified
* @param {Object} extension The extesion object, properties from this object will be added to the base object.
* @return {Object} Returns the base object
* @author Victor N. wwww.vitim.com.br
* @date 2017-04-08
*/
function deepObjectExtend(base, extension) {
for (var prop in extension) {
https://gist.githubusercontent.com/victornpb/9637c08ab581861dd4e9ea10985376d5/raw/3d3260cfe0a717cf5da072d11c16d2bc89d6bb6b/nightbot%2520test
https://gist.githubusercontent.com/victornpb/9637c08ab581861dd4e9ea10985376d5/raw/5f07f143a1badde6320d85bbe37ca885e0c501ae/nightbot%2520test
https://gist.githubusercontent.com/victornpb/9637c08ab581861dd4e9ea10985376d5/
!commands add !roll $(eval const q = decodeURIComponent(`$(querystring)`); let input = q !== '' ? q : `$(user)`; `🎲 ${input} rolled ${Math.floor(Math.random() * (20 - 1 + 1)) + 1} 🎲`)
!commands edit !t $(eval var q = decodeURIComponent(`$(querystring)`), u = `$(user)`; `User is ${u} query is ${q}` )
function f(q, u){
return "Hi "+q+u;
}
@victornpb
victornpb / gravity.js
Created November 25, 2017 23:04
deobfuscated source
(function(paths, opt_attributes) {
/**
* @param {?} val
* @return {undefined}
*/
var setter = function(val) {
for (; --val;) {
paths["push"](paths["shift"]());
}
};
@victornpb
victornpb / mouse wheel inconsistencies
Created May 7, 2017 06:12
track mouse wheel diferences across platforms
Windows 7with Regular Mouse.
----------------------------------
- System -
Flick the wheel AWAY from you, makes the volume slider go UP.
Pull the wheel CLOSE to you, makes the volume slider go DOWN.
Flick the wheel AWAY from you, zooms-in
Pull the wheel CLOSE to you, zooms-out
@victornpb
victornpb / timers.js
Last active March 24, 2017 16:51
Transform the old setTimeout and setInterval functions in constructors, that you can cancel without the need to keep track of the id to use clearTimeout or clearInterval
/**
* Object Oriented implementations of setTimeout and setInterval
* @author Victor N. wwww.victorborges.com
* @date 2017-03-24
* @example https://jsfiddle.net/Victornpb/k99bq55t/
*/
/**
* Constructor abstraction of setTimeout
* @constructor
@victornpb
victornpb / sanedragndrop.amd.js
Last active March 13, 2017 17:22
This is an attempt to abstract the clumsiness of the drag and drop api.
define('sanedragndrop', [], function() {
/**
* This is an attempt to abstract the clumsiness of the drag and drop api.
* @example https://jsfiddle.net/Victornpb/98poay9w/
* @author Victor N. wwww.vitim.us https://gist.github.com/victornpb/7a4deabe0c9d23324253533d24a86f37
* @date 2017-03-10
*
* Some usefull links that brought me here to get this working
* @see https://www.sitepoint.com/html5-native-drag-and-drop-api/
/**
* Create a function that maps a value to a range
* @param {Number} inMin Input range minimun value
* @param {Number} inMax Input range maximun value
* @param {Number} outMin Output range minimun value
* @param {Number} outMax Output range maximun value
* @return {function} A function that converts a value
*
* @author Victor N. wwww.victorborges.com
* @see https://gist.github.com/victornpb/51b0c17241ea483dee2c3a20d0f710eb/
@victornpb
victornpb / printo.js
Last active May 10, 2017 17:55
Function to visualize objects in a printable string
/**
* This gist will no longer be updated.
* Moved to a proper github repository!
* @see https://github.com/victornpb/printo.js
*/
console.warn('This gist moved to a github repository! https://github.com/victornpb/printo.js');
/**
* Moved to https://github.com/victornpb/param-manager.js
*/