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"
View notifica-per-pagamento.php
<?php /*screenshot: */
/*visibile anche sul front end, se ha effettuato l'accesso*/
add_action( 'wp_before_admin_bar_render', 'add_invoice_to_admin_bar' );
function add_invoice_to_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
'id' => 'pay_invoice',
'title' => '<span style="background: red;color:white;display:block;">Il pagamento della fattura 19 è in attesa da Novembre. Paga <strong style="font-weight:bold">oggi</strong> con PayPal o tramite bonifico.</span>',
'href' => '{Link per pagamento tramite paypal}'
bfred-it / duck-itunes-volume.scpt
Last active Aug 29, 2015
Duck iTunes' volume (lower volume and then raise it again) with a keyboard shortcut
View duck-itunes-volume.scpt
(* Duck iTunes' volume (lower volume and then raise it again) *)
(* Instructions:
- Create a service with Automator
- Add the "Run AppleScript" action
- Paste this in
- Save
- Open System Preferences > Keyboard > Shortcuts > Services
- Find what you just created
bfred-it /
Last active Aug 29, 2015
Frame tracker function (tell if two functions have been called in the same frame)

Frame tracker

This code will mark each frame and it will make it easier to pin down console.logs being called in the same frame—intended as in frames per second, not html frames.


Consider this code:

    setTimeout(function hello() { console.log('Logging "Hello"'); }, 10);
    setTimeout(function world() { console.log('Logging "World"'); }, 20);
bfred-it / CSS
Last active Aug 29, 2015
Sublime Text 2/3 snippet for the CSS "clip" property, for easier input
View CSS

This snippet will help you define the clip values in order:

  • top
  • left
  • height
  • width

If you're using SASS (or maybe LESS) that's it. Otherwise you will have to do some easy math in place:

  • height+top
  • width+left
bfred-it / slideshow.scss
Last active Aug 29, 2015
Automatic SCSS slideshow used on's homepage
View slideshow.scss
$images-count: 4;
$slideshow-duration: 6;
$slideshow-percentage-per-slide: 100/$images-count;
$slideshow-slides-overlap: $slideshow-duration/($images-count+1)+1;
.slideshow {
overflow: hidden;
position: relative;
height: 400px;
z-index: 0;
background-color: $color-golden;
bfred-it /
Last active Aug 29, 2015
Simple HTML5 forms cross-browser validation (UMD)

bfr Form Validation

Make HTML5 form validation cross-browser and with custom callbacks.


Create an HTML form with the correct attributes to enable the HTML Form validation (type, pattern and required) and then call bfrFormValidation.setup on the form(s) that need to be validated.

The three callbacks, if specified, will be called when validation is not met or met again.

bfred-it /
Last active Aug 29, 2015
Fix Yosemite's asymmetrical Time Machine menu icon

The asymmetrical Time Machine menu icon in Yosemite was bugging me, so I fixed it.

Icon comparison

Here's how to do it:

  1. Open Finder
  2. Press ⌘⇧G
  3. Go to /System/Library/CoreServices/Menu Extras/
  4. Replace the four TM*.pdf files with the ones found in this ZIP
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 =,''+Math.random(),'height='+h+',width='+w),
bfred-it / gist:2768880
Created May 22, 2012
Minisito WordPress multilingua
View gist:2768880
Struttura del sito:
• home <- home del sito italiano
• chi siamo
• contatti
• english home <- home del sito inglese (id: 15)
• • about us <- sottopagina
• • contacts <- sottopagina
You can’t perform that action at this time.