Skip to content

Instantly share code, notes, and snippets.

/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRelayRefetchContainer
*

Every language code in the CLDR and it's localized, native displayName. Perfect for language selector screens.

Generated from CLDR using:

for code in main/*; do code=$(basename $code); cat main/$code/languages.json | jq --arg code $code '{($code): .main[$code].localeDisplayNames.languages[$code] }' ; done | jq -s '. | add | with_entries( select( .value != null ) ) '

from flask import Flask, current_app
from cryptography.hazmat.primitives import hashes
import base64
import confcollect
from acme import jose
DEFAULT_CONFIG = {
'DEBUG': False,
'ACCOUNT_THUMBPRINT_BASE64': '',
'ACCOUNT_JSON': ''
FAILED: pip3 install --upgrade rtyaml email_validator>=1.0.0 free_tls_certificates>=0.1.3 idna>=2.0.0 cryptography>=1.0.2 boto psutil
-----------------------------------------
Downloading/unpacking rtyaml
Downloading rtyaml-0.0.3.tar.gz
Running setup.py (path:/tmp/pip_build_root/rtyaml/setup.py) egg_info for package rtyaml
Requirement already up-to-date: email-validator>=1.0.0 in /usr/local/lib/python3.4/dist-packages
Downloading/unpacking free-tls-certificates>=0.1.3
Downloading free_tls_certificates-0.1.6.tar.gz
Running setup.py (path:/tmp/pip_build_root/free-tls-certificates/setup.py) egg_info for package free-tls-certificates
@miracle2k
miracle2k / splitProps.js
Created September 10, 2016 11:09
Split a properties object into multiple objects based on the propTypes definitions of components.
/**
* Split a properties object into multiple objects based on the
* propTypes definitions of components.
*
* Usage:
*
* const [modalProps, dialogUIProps, otherProps] =
splitProps(this.props, Modal, DialogUI);
*
* Why?
@miracle2k
miracle2k / printesc.py
Last active August 25, 2016 13:10
Python ESC/POS tests
# coding: utf-8
#
# Usage: python printbon.py | lp -d EPSON_TM-P2.01
from escpos import printer
from escpos.constants import FS
Epson = printer.Dummy()
@miracle2k
miracle2k / gist:d4a28ea02279fa47e532
Created September 29, 2015 06:55
What RelayQL strings look like after going through the generator.
var GraphQL = Relay.QL.__GraphQL;
return new GraphQL.QueryFragment(
'Builder', 'AddMenuItemPayload',
[new GraphQL.Field('node', null, null, null, null, null, {parentType: 'AddMenuItemPayload'}),
new GraphQL.Field('client', [
new GraphQL.Field('menuitems', [
new GraphQL.Field('count', null, null, null, null, null, {parentType: 'MenuItemConnection'})],
null,
[new GraphQL.Callv('first', new GraphQL.CallVariable('format'))],
null, null, {parentType: 'Client', connection: true, nonFindable: true}),
"scripts": {
"build-js": "react-native bundle --url 'lib/index.ios.bundle?platform=ios&dev=' --minify && mv ios/main.jsbundle ios/project && git update-index --assume-unchanged ios/project/main.jsbundle",
},
@miracle2k
miracle2k / example.js
Created September 26, 2015 10:42
Simplify relay using decorators
@relayRoot
@relayContainer({
client: () => Relay.QL`
fragment on Client {
id,
menuitems(first: 50) {
}
}
`
})
@miracle2k
miracle2k / gist:7105912ca21028f64e52
Last active August 29, 2015 14:13
Automagic __repr__ for SQLAlchemy entities with primary key columns with Declarative Base.
# Adapted from http://foobar.lu/wp/2013/07/05/automagic-__repr__-for-sqlalchemy-entities-with-primary-key-columns-with-declarative-base/
class RepresentableBase(object):
"""
This class can be used by ``declarative_base``, to add an automatic
``__repr__`` method to *all* subclasses of ``Base``. This ``__repr__`` will
represent values as::
ClassName(pkey_1=value_1, pkey_2=value_2, ..., pkey_n=value_n)