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 / 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)?
@stecb
stecb / commonpwd
Created August 28, 2012 12:35
List of common passwords
var commonPWD = ["password", "123456", "12345678", "1234", "qwerty", "12345", "dragon", "pussy", "baseball", "football", "letmein",
"monkey", "696969", "abc123", "mustang", "michael", "shadow", "master", "jennifer", "111111", "2000", "jordan", "superman", "harley", "1234567", "fuckme", "hunter", "fuckyou", "trustno1", "ranger", "buster", "thomas", "tigger", "robert", "soccer", "fuck", "batman", "test", "pass", "killer", "hockey", "george", "charlie", "andrew", "michelle", "love", "sunshine", "jessica", "asshole", "6969", "pepper", "daniel", "access", "123456789", "654321", "joshua", "maggie", "starwars", "silver", "william", "dallas", "yankees", "123123", "ashley", "666666", "hello", "amanda", "orange", "biteme", "freedom", "computer", "sexy", "thunder", "nicole", "ginger", "heather", "hammer", "summer", "corvette", "taylor", "fucker", "austin", "1111", "merlin", "matthew", "121212", "golfer", "cheese", "princess", "martin", "chelsea", "patrick", "richard", "diamond", "yellow", "bigdog", "secret", "asdfgh",
@stecb
stecb / youtube.com.js
Created September 7, 2012 09:09
dotjs youtube.com
var logo = document.querySelector('#logo')
, cb = document.querySelector('#watch-channel-brand-div');
logo && (logo.src = '//bit.ly/ghD24e');
cb && (cb.innerHTML = 'I h8 fucking IE');
@stecb
stecb / gist:3839337
Created October 5, 2012 11:31
Select all checkbox fb
!function(){var a=Array.prototype.slice;a.apply(document.querySelectorAll(".checkbox")).forEach(function(a){a.checked="checked"})}()
@stecb
stecb / gist:3958943
Created October 26, 2012 13:51
drop from url (for carrierwave)
- content_for :javascript_page do
:javascript
$(document).bind('drop', function(e) {
var url
, target = $(e.target)
, remote_avatar = $('#user_remote_avatar_url')
;
if (target.hasClass('dropzone')) {
url = $(e.originalEvent.dataTransfer.getData('text/html')).filter('img').attr('src');
if (target.hasClass('attachments-drop"')) {
function doubleInteger(i) {
// i will be an integer. Double it and return it.
return i*2;
}
function isNumberEven(i) {
// i will be an integer. Return true if it's even, and false if it isn't.
return i%2 === 0;
}