Skip to content

Instantly share code, notes, and snippets.

View stecb's full-sized avatar
🤓
Ciao!

Stefano Ceschi Berrini stecb

🤓
Ciao!
View GitHub Profile
@stecb
stecb / throttle
Last active August 29, 2015 14:03
Throttling function
function throttle(e,t){var n,r;return null==t&&(t=100),r=null,n=null,function(){var i,s,o;return s=+(new Date),o=this,i=arguments,n&&n+t>s?(clearTimeout(r),r=setTimeout(function(){return n=s,e.apply(o,i)},t)):(n=s,e.apply(this,i))}}
@stecb
stecb / github_rockstar_faker.js
Last active August 29, 2015 14:04
Github Rockstar faker
// go to your github.com/xxx page, copy and paste this inside your favorite web dev tools console, make a screenshot, and boom: You're the new github rockstar
!function(){
var contribsRgbSets=["214,230,133","140,198,101","68,163,64","30,104,35"],
l=contribsRgbSets.length,
selector = '.day';
[].forEach.call(document.querySelectorAll(selector), function(el) {
el.style.fill="rgb(" + contribsRgbSets[~~(Math.random()*l-1)] + ")";
});
}();
setInterval(function(){var e=["255,238,74","255,197,1","254,150,0","3,0,28"],t=e.length,n=".day";[].forEach.call(document.querySelectorAll(n),function(n){n.style.fill="rgb("+e[~~(Math.random()*t-1)]+")"})},200)

Keybase proof

I hereby claim:

  • I am stecb on github.
  • I am stecb (https://keybase.io/stecb) on keybase.
  • I have a public key whose fingerprint is C21B 942B F5B8 1026 5597 C395 7494 041B EB13 95C9

To claim this, I am signing this object:

(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
@stecb
stecb / LICENSE.txt
Created May 30, 2011 12:50 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@stecb
stecb / fy
Created June 16, 2011 21:55
Edit style directly in your browser (paste into address bar)
data:text/html,<!DOCTYPE html><html><body><style style="display:block" contentEditable>h1 { color: red }</style><h1>Fuck yea</h1></body></html>
@stecb
stecb / js_asset_rails.haml
Created December 13, 2011 10:01
Add specific js inside a page, rails
- #Inside your application (i.e. application.html.haml) layout put this at the end of the body tag
= yield :assets_bottom_body
- #then, inside your specific page (i.e. /foo/bar.html.haml) put
- content_for :assets_bottom_body do
- javascript_include_tag "some_js_file"
- # or something else specific for this page like :javascript
@stecb
stecb / gist:2852850
Created June 1, 2012 15:12
Hook post-commit to get a snapshot
#!/bin/sh
# Put this in .git/hooks/post-commit (and chmod 755)
CUR_BRANCH=`git rev-parse --abbrev-ref HEAD`
# do this awesomeness if current branch is master
if [ "$CUR_BRANCH" == "master" ]; then
echo "Smile for the camera..."
MSG=`git log -1 --pretty=format:%s`
SNAPSHOT="last_commit.jpg"
@stecb
stecb / gist:3011759
Created June 28, 2012 14:46
One line add/remove class - js/jquery/mootools
// You know you can write this (96 bytes):
if ( top < 10 ){
header.removeClass('scrolled');
} else {
header.addClass('scrolled');
}
// in this way (60 bytes)?