Skip to content

Instantly share code, notes, and snippets.

// Side-effect inside constructor()
class Page extends React.Component {
static propTypes = {
fetch: PropTypes.func,
isPending: Proptypes.bool, // from store: It could be dirty from previous rendering
data: PropTypes.object, // from store: It could be dirty from previous rendering
resetState: PropTypes.func, // It will clean both isPending and data
}
@marqu3z
marqu3z / post-checkout
Last active February 14, 2017 17:09
git post-checkout hook to log the commit difference between the current HEAD of the current branch and each remote master
#!/bin/sh
for remote in $(git remote);
do
echo "\n\nYour current HEAD diff from $remote/master: \n$(git log --left-right --graph --cherry-pick --oneline HEAD...$remote/master) \n";
done
@marqu3z
marqu3z / netflix_sub_shortcut
Created March 22, 2016 22:12
Netflix shortcut to switch sub ita-eng
(function() {
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
script.onload = script.onreadystatechange = function(){
// define a handler
function changeLang(e) {
langMap = {
69: 'inglese',
73: 'italiano'
}
@marqu3z
marqu3z / Language-Country
Last active August 29, 2015 14:24
Language Culture Names, Codes, and ISO Values (parsed from here https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx)
[{"code":"af-ZA","name":"Afrikaans - South Africa"},{"code":"sq-AL","name":"Albanian - Albania"},{"code":"ar-DZ","name":"Arabic - Algeria"},{"code":"ar-BH","name":"Arabic - Bahrain"},{"code":"ar-EG","name":"Arabic - Egypt"},{"code":"ar-IQ","name":"Arabic - Iraq"},{"code":"ar-JO","name":"Arabic - Jordan"},{"code":"ar-KW","name":"Arabic - Kuwait"},{"code":"ar-LB","name":"Arabic - Lebanon"},{"code":"ar-LY","name":"Arabic - Libya"},{"code":"ar-MA","name":"Arabic - Morocco"},{"code":"ar-OM","name":"Arabic - Oman"},{"code":"ar-QA","name":"Arabic - Qatar"},{"code":"ar-SA","name":"Arabic - Saudi Arabia"},{"code":"ar-SY","name":"Arabic - Syria"},{"code":"ar-TN","name":"Arabic - Tunisia"},{"code":"ar-AE","name":"Arabic - United Arab Emirates"},{"code":"ar-YE","name":"Arabic - Yemen"},{"code":"hy-AM","name":"Armenian - Armenia"},{"code":"Cy-az-AZ","name":"Azeri (Cyrillic) - Azerbaijan"},{"code":"Lt-az-AZ","name":"Azeri (Latin) - Azerbaijan"},{"code":"eu-ES","name":"Basque - Basque"},{"code":"be-BY","name":"Belarusian -
@marqu3z
marqu3z / i18n_country_info
Created July 10, 2015 09:51
Map of country info ISO codes, currencies, languages, phone, postal codes etc etc (Parsed from http://download.geonames.org/export/dump/countryInfo.txt)
[
{
"ISO": "AD",
"ISO3": "AND",
"ISO-Numeric": 20,
"fips": "AN",
"Country": "Andorra",
"Capital": "Andorra la Vella",
"Area(in sq km)": 468,
"Population": 84000,
[
{"code":"ab","name":"Abkhaz","nativeName":"аҧсуа"},
{"code":"aa","name":"Afar","nativeName":"Afaraf"},
{"code":"af","name":"Afrikaans","nativeName":"Afrikaans"},
{"code":"ak","name":"Akan","nativeName":"Akan"},
{"code":"sq","name":"Albanian","nativeName":"Shqip"},
{"code":"am","name":"Amharic","nativeName":"አማርኛ"},
{"code":"ar","name":"Arabic","nativeName":"العربية"},
{"code":"an","name":"Aragonese","nativeName":"Aragonés"},
{"code":"hy","name":"Armenian","nativeName":"Հայերեն"},
#Author: Marco Andreotti
# Email: marco.andreotti@tanaza.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# The script checks if a container is running.
# OK - running
# UNKNOWN - does not exist
// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
#######################################################################################################################
#
# Purpose: Bash script to fix a few elements of the default Dokku script with running correctly on Debian Wheezy
# Author: Shirkey <dev@shirkey.me>
# License: MIT
# Tested with:
# * Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
# * v0.2.1 of Dokku installer script
#
#######################################################################################################################