Skip to content

Instantly share code, notes, and snippets.

Federico Brigante bfred-it

Block or report user

Report or block bfred-it

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
bfred-it / Emmet.sublime-settingsJSON
Created Mar 13, 2014
Use this setting to disable Emmet's CSS autocompletion
View Emmet.sublime-settingsJSON
"disable_tab_abbreviations_for_regexp": "source\\.s?css"
bfred-it /
Created Dec 6, 2013
TweenLite.disperseTo(): a plugin to randomize values

Sometimes we overcomplicate things unnecessarily. I realized it after I wrote this plugin.
Twenty-nine lines to be able to write this:

TweenLite.disperseTo(elements, 1, {x:100}, {x:5}); //this means: animate elements.x to 100±5

instead of this:

for(var i = 0, l = elements.length; i < l; i++){[i], 1, {x: 100 - 5 + 10*Math.random() });
bfred-it / element-rotation-with-mouse.js
Last active Dec 27, 2015
Quick way to rotate any element on a page just by moving the mouse around. Good for testing
View element-rotation-with-mouse.js
var elementStyle = document.querySelector('SELECTOR HERE').style;
document.addEventListener('mousemove', function (e) {
var transform = 'rotateX('+e.pageY+'deg) rotateY('+e.pageX+'deg)';
elementStyle.webkitTransform = transform;
elementStyle.transform = transform;
}, false);
bfred-it / TimelineLite.addDelay.js
Last active Dec 24, 2018
Method to add delays at any position in Greensocks TimelineLite and TimelineMax (Javascript GSAP)
View TimelineLite.addDelay.js
* Add a delay at the end of the timeline (or at any label)
* @param {number} delay Seconds to wait
* @param {string} position Label name where to start the delay
* Usage: tl.addDelay(4); //easy!
TimelineLite.prototype.addDelay = function (delay, position) {
var delayAttr;
if(typeof delay === 'undefined' || isNaN(delay)){
bfred-it / Instructions
Last active Feb 9, 2018
YouTube "I'm Feeling Lucky" search engine for Chrome
View Instructions
Visit chrome://settings/searchEngines
Enter a name, like "YouTube direct"
Pick a keyword, like "y"
Paste this URL:
Click [Done]
In the address bar, type your keyword followed by the video name, like: "y get lucky" (try it!)
bfred-it / dabblet.css
Created Oct 22, 2012
CSS transition after animation
View dabblet.css
* CSS transition after animation
div {
transition: transform 1s;
div:hover {
transform: rotate(45deg);
div:active {
bfred-it / gist:3865283
Created Oct 10, 2012
Check for scrollbar visibility and load jScrollPane if scrollbars are visible
View gist:3865283
//This example requires YepNope or Modernizr.load (which are the same) and jQuery
var customScroll = (function () {
var customScroll = {};
customScroll.selector = ".entry-gallery, .entry-main";
customScroll.init = function () {
try {
(yepnope || Modernizr.load)({
bfred-it / gist:3762133
Created Sep 21, 2012
Replace <html>'s "no-js" class with "js"
View gist:3762133
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/, 'js');
bfred-it / gist:3379426
Created Aug 17, 2012
Switch CSS background instead of resizing it. With media queries
View gist:3379426
background: url(res/bg/1280.jpg) fixed center black;
@media only screen and (min-width:1281px),
only screen and (min-height:801px) {
html{ background-image: url(res/bg/1366.jpg); }
@media only screen and (min-width:1367px),
only screen and (min-height:855px) {
html{ background-image: url(res/bg/1440.jpg); }
bfred-it / action.js
Created Jul 20, 2012
Add class when leaving page
View action.js
//make sure downloads open in another page with target="_blank"
//"beforeunload" is fired any time a link is clicked.
//If the link points to a file to download, the user won't be actually leaving the page, but beforeunload will still have fired.
(function () {
var unload = {};
unload.init = function () {
//cache html element
unload.$html = $(document.documentElement);
You can’t perform that action at this time.