Skip to content

Instantly share code, notes, and snippets.

View Calvein's full-sized avatar
🐶

François Robichet Calvein

🐶
View GitHub Profile
@Calvein
Calvein / gist:1258708
Created October 3, 2011 08:42
$(window).unload(); does not seem to work on the lastest Chrome build (14.0.835.186 Ubuntu)
The simple test on the exemple page does not work on Chrome
`$(window).unload( function () { alert("Bye now!"); } );`
It fired an error : "Blocked alert('Bye now!') during unload."
I can't find if it's a Chrome or jQuery bug or if it's a security thing.
But it works fine on Chromium 13.0.782.41 Ubuntu.
javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://raw.github.com/gist/1926444/b8bfd192702e0fa021fb349ed1605747f0dad271/jgthms.com%20theme%20changer';document.body.appendChild(s);})();
@Calvein
Calvein / gist:2025652
Created March 13, 2012 00:28
Get the `animationend` name event
var animationEndName = (Modernizr.prefixed('animation') + "End").replace(/^ms/, "MS").replace(/^Webkit/, "webkit").replace(/^Moz.*/, "animationend");
@Calvein
Calvein / Custom.css
Created March 23, 2012 20:24
Solarized Dark Skin for the Chrome DevTools
body#-webkit-web-inspector #main{background-color:#002b36!important}body#-webkit-web-inspector #main .panel.network,body#-webkit-web-inspector #main .panel.timeline,body#-webkit-web-inspector #main .panel.profiles,body#-webkit-web-inspector #main .panel.audits,body#-webkit-web-inspector #main .panel.extension{background-color:#fff!important}body#-webkit-web-inspector #console-messages a:hover,body#-webkit-web-inspector #console-messages .console-formatted-function,body#-webkit-web-inspector #console-messages .console-formatted-object{color:#93a1a1!important}body#-webkit-web-inspector #console-prompt,body#-webkit-web-inspector #console-messages a,body#-webkit-web-inspector #console-messages .console-message,body#-webkit-web-inspector #console-messages .console-group-messages .section .header .title{color:#839496!important}body#-webkit-web-inspector #console-messages .console-formatted-null,body#-webkit-web-inspector #console-messages .console-formatted-undefined{color:#657b83!important}body#-webkit-web-inspect
@Calvein
Calvein / console.sprintf.js
Created April 4, 2012 17:24
console.sprintf()
// Sprintf from http://www.diveintojavascript.com/projects/javascript-sprintf
!function(console) {
var sprintf = (function() {
function get_type(variable) {
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
}
var str_repeat = function(str, qty, separator){
// ~~var — is the fastest available way to convert anything to Integer in javascript.
// We'll use it extensively in this lib.
@Calvein
Calvein / Readme.md
Created June 14, 2012 20:06
£ in € for the English sales

It's the English sales !!§!

Just create a new bookmark in your toolbar and paste the following code as URL (because we can't make bookmarlet links with GitHub markdown) :

javascript:!function(){s=document.createElement('script'),s.src='https://raw.github.com/gist/2932607/ddb79d0d67f5aea20083aa08dd6e056a927a5d66/bookmarklet.min.js?v='+~~(new Date),document.body.appendChild(s)}();
@Calvein
Calvein / gist:2937876
Created June 15, 2012 17:59
On the mouseenter, add a class corresponding to the axis which the mouse enter (jQuery)
/**
* On the mouseenter, add a class corresponding to the axis which the mouse enter
* top-left | top | top-right
* left | | right
* bottom-left | bottom | bottom-right
*/
var $container = $('div')
, width = $container.width() / 3
, height = $container.height() / 3
, className, x, y
@Calvein
Calvein / gist:3116089
Created July 15, 2012 09:42
Show the background image of http://movies.io
/*
* Show the background image on http://movies.io
* http://i.imgur.com/E99gy.jpg => http://i.imgur.com/t1lm7.png
* You need to put this at the beginning of the <body> (before every <div>s)
* <span>☼</span>
*/
body > span:first-of-type {
position: absolute;
top: 0;
@Calvein
Calvein / app.js
Created July 18, 2012 19:19
Node app to receive emails of the Steam sales
// $ npm install node-phantom nodemailer moment lodash
// Modules definitions
var phantom = require('node-phantom')
, nodemailer = require("nodemailer")
, moment = require('moment')
, _ = require('lodash')
// Email stuff
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Gmail"
@Calvein
Calvein / script.js
Created July 30, 2012 19:16
The beginning of a Chrome Extension to add markdown on http://twitter.com
/*
@TODO :
- Add italic-bold
- Change the .tweet-counter value
*/
!function(window, document) {
// From http://mothereff.in/twitalics
var types = {
// `new Number` is needed since we want to add properties to the numbers later (cache)