Skip to content

Instantly share code, notes, and snippets.

@abriemme
abriemme / store.js
Last active December 14, 2015 13:59
HTML5 LocalStorage Array and objects
Storage.prototype.setObj = function(key, obj) {
return this.setItem(key, JSON.stringify(obj));
}
Storage.prototype.getObj = function(key) {
var value = this.getItem(key);
return value && JSON.parse(value);
}
@abriemme
abriemme / gist:6304870
Last active December 21, 2015 12:19 — forked from hileon/gist:1311735

Sublime Text – Useful Shortcuts

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

Reactive CSS Transitions

These simple CSS blocks are alive. Each block reacts to its neighbors by transforming border-radius and color. Endless block formations, endless reactions between them.

A Pen by Yogev Ahuvia on CodePen.

License.

@abriemme
abriemme / tmpl.js
Last active December 26, 2015 19:08
Very very simple jQuery templating "engine"
function tmpl(template, data) {
return template.text().replace(/\{([\w\.]*)\}/g, function(str, key) {
var v = data[key];
return (typeof v !== "undefined" && v !== null) ? v : "";
})
}
/*
Usage:
crack Sublime Text (2 and 3)
1. Open Sublime in a HEX editor (the executable file)
2. Find 43 33 33 42 30 32
3. Replace in the string 33 42 with 32 42
4. Save
5. Enter the license below:
—–BEGIN LICENSE—–
Patrick Carey
@abriemme
abriemme / reply_regex.py
Last active August 29, 2015 14:09
Email reply parser (python) fr+en
import re
REPLY_SPLITTER_REG = re.compile(r"^From:\s*[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}|^From:\s.*\[mailto:[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\]|^On\s.*\s<[\s|][a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>[\s|]wrote:$|^On\s.+?wrote:$|^Le\s.*\s<[\s|][a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>[\s|]a\sécrit\s:$|^Le\s.+?a\sécrit\s:$|^.*<[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>.*$|^-+[\s|]Message\stransféré[\s|]-+$|^-+[\s|]Original\s+Message[\s|]-+$|^-+[\s|]Reply Message[\s|]-+$|^Sent.*from.*my.*|^envoyé\s+depuis\s+mon.*| ^envoyé\s+de\s+mon.*|^" + 'reply above this line' + "|^↑ Merci de répondre par dessus cette ligne ↑$|^-- $|^>\s|^[-|_]{3,}$|^\*{5,}DISCLAIMER\*{5,}$|^—$", re.I | re.M)
#try it here : http://regex101.com/r/oE7sC7/3
@abriemme
abriemme / tiny$.js
Created November 12, 2014 15:23
super-tiny jQuery-like API JavaScript library
/*
* for more info see : https://github.com/dciccale/ki.js/blob/master/ki.js
* ie8 compatible !!
* included functions : $.create, $.each $.isFunction, on, off, hasCLass, addClass, removeClass, each show, append, hide, hmtl, attr, removeAttr, css, remove, ...
* usefull for developing third-party jsavascript widgets
*/
!function (window, document, array, prototype, event_listener) {
f = document['add' + event_listener]
function init(selector, d, i) {
@abriemme
abriemme / es.sh
Last active August 29, 2015 14:17 — forked from Globegitter/es.sh
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Keybase proof

I hereby claim:

  • I am abriemme on github.
  • I am abrymaxime (https://keybase.io/abrymaxime) on keybase.
  • I have a public key whose fingerprint is 2288 7E3B 5245 E3C4 A4AB 3D42 5FC4 9A22 9A32 9ECC

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am abriemme on github.
  • I am abriemme (https://keybase.io/abriemme) on keybase.
  • I have a public key ASAYmeTvrGnDpSsSdSSBvDCxWajaVFtDLpJ2dUy_h3mbxgo

To claim this, I am signing this object: