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
bfred-it / gist:2077913
Created Mar 18, 2012
Get popup player from any embedded Flash video
View gist:2077913
//Click on the closest parent element of a video to have it popped out and the main window closed
(function (css, int, d, s) {
d.body.appendChild(s = document.createElement('style'));
s.innerHTML = ':hover{border-left:3px solid papayawhip;}';
d.body.onclick = function (e) {
var popd,
v = e.srcElement.querySelectorAll('embed,object,iframe')[0] || d.querySelectorAll('embed,object,iframe')[0],
w = int(css(v).width) || 400,
h = int(css(v).height) || 300,
pop = window.open(d.location.href,''+Math.random(),'height='+h+',width='+w),
@bfred-it
bfred-it / gist:2768880
Created May 22, 2012
Minisito WordPress multilingua
View gist:2768880
<?php
/*
Struttura del sito:
• home <- home del sito italiano
• chi siamo
• contatti
• english home <- home del sito inglese (id: 15)
• • about us <- sottopagina
• • contacts <- sottopagina
@bfred-it
bfred-it / gist:2946234
Created Jun 18, 2012
<button> css reset, now you can stop using <a>
View gist:2946234
button{
display: inline-block;
cursor: pointer;
color: inherit;
padding: inherit;
border: none;
background: inherit;
box-sizing: content-box;
font: inherit;
-webkit-appearance: none;
@bfred-it
bfred-it / style.css
Created Jul 15, 2012
Facebook: Finally Readable (CSS)
View style.css
/* to be compressed via http://compressor.ebiene.de/*/
/*admin panel in page*/
#AdminTip,
.notification,
.preview,
.author,
.timestamp,
.uiHeader *,
@bfred-it
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);
@bfred-it
bfred-it / gist:3379426
Created Aug 17, 2012
Switch CSS background instead of resizing it. With media queries
View gist:3379426
html{
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
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
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
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
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: http://www.google.com/search?q=%s+site%3Ayoutube.com&btnI=Im+Feeling+Lucky
Click [Done]
In the address bar, type your keyword followed by the video name, like: "y get lucky" (try it!)
You can’t perform that action at this time.