Skip to content

Instantly share code, notes, and snippets.

View rhumlover's full-sized avatar

Thomas LE JEUNE rhumlover

  • San Francisco, California
View GitHub Profile
@rhumlover
rhumlover / countries_with_vat.txt
Created March 15, 2016 14:58
Countries with a VAT system
1 Austria AT
2 Belgium BE
3 Brazil BR
4 Bulgaria BG
5 Croatia HR
6 Cyprus CY
7 Czech Republic CZ
8 Denmark DK
9 Estonia EE
10 Finland FI
@rhumlover
rhumlover / update_git_index.sh
Created November 11, 2015 02:04
When your git is stubborn and stuck with files that don't disappear (even with reset --hard), so you can't change branch: update git indexes so git knows those files didn't change
git ls-files -m | xargs -I {} git update-index --assume-unchanged {}
Worker = require 'models/worker'
class ScopedFrame
# Private
_uniqueId = (prefix) ->
return prefix + Math.random().toString(36).slice(2)
_messageReceivedByParent = (message) ->
{origin, data} = message
@rhumlover
rhumlover / remove_files_pattern.sh
Created March 25, 2015 09:46
remove files matching a certain pattern
find . -type f -name "*conflicted copy*" -delete
(function(window, document, undefined) {
var YMHandlebars = function() {
var a = function() {
"use strict";
function a(a) {
this.string = a
}
var b;
return a.prototype.toString = function() {
@rhumlover
rhumlover / cf.md
Last active August 29, 2015 14:10
Why CoffeeScript for a non-ruby developer?

Pros:

  • readability: so nice to get rid of semicolons and curly braces, loops are amazingly transparents
  • allows a real "class"-based work. It's perfect if you work with Backbone, for instance. Might be less true with Angular and such
  • defines some meaningful shortcuts, to create functions or closures for example. Next version of EcmaScript learned about it and will feature the "arrow" notation for functions
  • it pairs perfectly with CSS preprocessors, but mainly SASS: focus on the content, less on the appearance

Cons:

  • you need to perfectly know how JavaScript works. The CoffeeScript output is really nice, but writing it can lead to unexpected side-effects (forgot double arrow instead of single arrow), real prototype inheritance, difference between class properties, instance properties, scopes
  • you might want to focus on bad ways to improve performance. For instance, CS knows that defined functions inside loops are bad, so it will generate a function outside the loop and call it inside. If lat
var QS = (function(loc) {
var data = {},
query = loc.search.substring(1),
vars = query.split('&'),
dUc = decodeURIComponent;
vars.forEach(function(couple) {
var pair = couple.split('='),
key = dUc(pair[0]),
value = dUc(pair[1]);
@rhumlover
rhumlover / thumbnails.md
Created September 9, 2014 01:00
Thumbnail calculations

Mobile Web Devices Usage

TL;DR: The final most common thumbnail sizes

133x74 (2.7%)

Samsung GT-S5360 Galaxy Y, Samsung GT-S5830i Galaxy Ace

200x112 (8.6%)

Samsung GT-18190 Galaxy S3 Mini, Nokia Lumia 520, Samsung GT-S7562 Galaxy S Duos, Samsung GT-S7582 Galaxy S Duos 2, Samsung GT-I8262 Galaxy Duos, Samsung GT-S7262 Galaxy Star S7262, Samsung GT-19100 Galaxy S2, Samsung GT-I9082 Galaxy Grand Duos

@rhumlover
rhumlover / feops 2014.md
Last active October 28, 2015 05:27
Front-End Ops 2014 sum up !
# Disable and enable event on scroll begin and scroll end.
# @see http://www.thecssninja.com/javascript/pointer-events-60fps
root = document.documentElement
timer = null
window.addEventListener 'scroll', ->
clearTimeout timer
# Pointer events has not already been disabled.
if not root.style.pointerEvents
root.style.pointerEvents = 'none'