Skip to content

Instantly share code, notes, and snippets.

View pomeh's full-sized avatar

Romain Guerin pomeh

View GitHub Profile
@pomeh
pomeh / Default (Windows).sublime-keymap
Created January 14, 2015 12:03
Sublime Text 3 config example for sublime_findDoc package
// see Sublime Text package findDoc at https://github.com/zckrs/sublime_findDoc
[
// multiple shortcuts => multiple website
// aka: search on Google
{
"keys": ["ctrl+k", "ctrl+g"],
"command": "find_doc_selection",
"args" : {"url" : "https://google.fr/#q=%s" }
},
@pomeh
pomeh / copy-to-clipboard.js
Created July 27, 2014 17:39
JavaScript copy to clipboard function
function copyToClipboard(value) {
var tbx = document.createElement('input')
document.body.appendChild(tbx);
tbx.value = value;
tbx.focus();
tbx.setSelectionRange(0, tbx.value.length);
document.execCommand("copy");
document.body.removeChild(tbx);
}
@pomeh
pomeh / node-http-proxy.js
Created January 4, 2014 00:59
Basic node.js Web proxy
// inspired by Sébastien Chopin (atinux) at http://www.atinux.fr/2013/12/03/tricher-candy-crush-nodejs/
var http = require('http'),
request = require('request'),
port = 8080;
// this won't work for HTTPS URL
http.createServer(function onRequest (req, res) {
// this proxy only logs requests it receives
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
{
"name": "French TV",
"description": "Watch French TV",
"author": "pomeh",
"unblocker_rules": {
"tf1": {
"description": "Watch TF1",
"link": "tf1.fr",
"icon": "http://www.tf1.fr/favicon.ico",
"cmds": [
@pomeh
pomeh / pr.md
Created September 17, 2012 14:54 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

This is a feedback for the article at http://buildnewgames.com/sprite-animation/. It contains code review, bug fixes and sort of improvements.

First of all, the article concerned contains a lot of jsfiddle demonstration. I think it's really nice as we can see the code, see the result and make our change as we like. But it seems like the usage of jsfiddle may be improved. Here is the trick: jsfiddle has 3 "fields" where we can type code (for HTML, CSS, and Javascript). So please stop writing every things like this http://jsfiddle.net/dariusk/wa8eV/light/, that's insane. What is easier to read between this http://jsfiddle.net/pomeh/tQE89/ and this http://jsfiddle.net/pomeh/tQE89/1/ ? If you pay attention to the source, I've modified the onload function to make it an anonymous one. Here is why and what happens, and here are some solutions, from worst to [best](http://jsfiddle.net/pomeh/ZjF3y/3/

@pomeh
pomeh / wtcraft.com.user.js
Created April 2, 2012 19:27
my userscripts
// ==UserScript==
// @name wtcraft.com
// @description Removes annoying ads on wtcraft.com, UX anyone ?
// @author pomeh
// @match http://www.wtcraft.com/
// @match http://www.wtcraft.com/*
// @match http://wtcraft.com/
// @match http://wtcraft.com/*
// @include http://www.wtcraft.com/
// @include http://www.wtcraft.com/*
@pomeh
pomeh / jQuery.fn.getEvents
Created February 11, 2012 21:19
Get jQuery events informations
jQuery.fn.getEvents = function( type ) {
var evts = jQuery._data( this[0] ).events;
return evts && evts[type] || evts;
};
// usage
jQuery( "#foo" ).getEvents();
jQuery( "#foo" ).getEvents( "click" );