This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ProductCategoryRow = React.createClass({ | |
render: function() { | |
return (<tr><th colSpan="2">{this.props.category}</th></tr>); | |
} | |
}); | |
var ProductRow = React.createClass({ | |
render: function() { | |
var name = this.props.product.stocked ? | |
this.props.product.name : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for a, b, c in itertools.product([True, False], repeat=3): | |
print (a and (b or c)) is (a and b or c) | |
# True | |
# True | |
# True | |
# False | |
# True | |
# False | |
# True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Skrypt pozwala na pobieranie z napiprojekt.pl gdy nie posiadamy aplikacji. | |
ID z URL z wynikow wyszukiwania podajemy jako argument do skryptu. Np. | |
$ python napiprojekt.py e79975aa41dfecf52b81ac8231f4abde > napisy.txt | |
Wymagania: | |
* Python 2.7 | |
* Paczki z requirements.txt | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hacker News - Score like reddit | |
// @namespace http://avalanchy.tk/ | |
// @version 0.1 | |
// @description Swap score with the position | |
// @author avalanchy | |
// @match https://news.ycombinator.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dpad Left DPAD_LEFT walk left | |
Dpad Right DPAD_RIGHT walk right | |
Dpad Up DPAD_UP walk forward | |
Dpad Down DPAD_DOWN walk backwards | |
Button A 3 jump / break or reverse | |
Button B 7 handbrake | |
Button X 1 run / accelerate | |
Button Y 2 shoot | |
Button L 6 change weapon down / look left in car |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from difflib import ndiff | |
from pprint import pformat | |
def dicts_diff(d1, d2): | |
return '\n'.join(ndiff(*(pformat(d).splitlines() for d in (d1, d2)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from dis import dis | |
>>> a = lambda: bool('') | |
>>> b = lambda: not not '' | |
>>> dis(a) | |
1 0 LOAD_GLOBAL 0 (bool) | |
3 LOAD_CONST 1 ('') | |
6 CALL_FUNCTION 1 | |
9 RETURN_VALUE | |
>>> dis(b) | |
1 0 LOAD_CONST 1 ('') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import subprocess | |
import sys | |
def branch_url(): | |
remote = sys.argv[2] | |
command = 'git branch --contains' | |
branch_name = subprocess.check_output(command, shell=True).strip(' *\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
if os.name in ('ce', 'nt', 'dos'): | |
def clear(): | |
subprocess.call('cls', shell=True) | |
elif 'posix' in os.name: | |
def clear(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""runs pybabel and check if files with jinja2 wrappers are in messages.pot""" | |
import os | |
# config some constants | |
ROOT_DIR = 'templates' | |
FILES_EXTENSIONS = ('.html', '.txt') | |
SEARCH_TAGS = ('{% trans', '_(') | |
OUTPUT_FILE = 'locales/messages.pot' |