This file contains 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
# coding: utf-8 | |
import re | |
regnum = re.compile(r'([0-9]+)') | |
def factory(units): | |
def flat(string): | |
"""minimize unit""" | |
string = string.replace(',', '') |
This file contains 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
# coding: utf-8 | |
import os | |
import filecmp | |
class Break(Exception): | |
"""for break recursive function | |
""" |
This file contains 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/env python | |
# coding: utf-8 | |
import socket | |
import functools | |
def nop(): | |
"""no operation""" |
This file contains 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
# coding: utf-8 | |
import re | |
_02 = (lambda s: '{0:0>2}'.format(s)) | |
_03 = (lambda s: '{0:0>3}'.format(s)) | |
MAP = { | |
'%a': r'(Sun|Mon|Tue|Wed|Thu|Fri|Sat)', | |
'%A': r'(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)', | |
'%w': r'([0-6]{1})', |
This file contains 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
# coding: utf-8 | |
import os | |
from boto.s3 import ( | |
connection as s3conn, | |
key as s3key, | |
) | |
from boto.exception import ( | |
S3ResponseError, |
This file contains 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/env python | |
# coding: utf-8 | |
import sys | |
def format_timezones(timezones, descriptor=sys.stdout): | |
_tz = () | |
for tz in sorted(t.split('/') for t in timezones): | |
for indent, region in enumerate(tz): | |
if len(_tz) > indent and _tz[indent] == tz[indent]: |
This file contains 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 string import ascii_uppercase | |
def to_column(number): | |
""" | |
:param int number: 1以上の数値 | |
""" | |
string = '' | |
while True: | |
number -= 1 |
This file contains 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 React from 'react' | |
import './checkboxWidget.styl' | |
let defaultStyle = {width: 22, height: 22} | |
const CheckBox = (props) => { | |
let onClick = () => !props.readonly && !props.disabled ? props.handleChange() : null | |
let borderColor = props.borderColor ? props.borderColor : '#aaa' | |
let backgroundColor = props.checked ? props.backgroundColor ? props.backgroundColor : '#transparent' : 'transparent' | |
let style = Object.assign({}, defaultStyle, props.style) |
This file contains 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
const deniedTagCondition = /^<\/?(script|style|link|iframe|embed|object|html|head|meta|body|form|input|button)/i | |
const deniedAttrCondition = /^(on.+|style|href|action|id|class|data-.*)/i | |
const escape = (txt) => { | |
if (txt.match(deniedTagCondition) || txt.indexOf('<!') === 0 || txt.indexOf('<?') === 0 || txt.indexOf('<\\') === 0) { return '' } | |
if (txt.indexOf('</') === 0) { return txt } | |
let outer = document.createElement('div') | |
outer.innerHTML = txt | |
let el = outer.querySelector('*') | |
if (!el) {return ''} |
This file contains 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 re | |
DEFAULT_MULTIPLIERS = { | |
'S': 1, | |
'M': 60, | |
'H': 60 * 60, | |
'd': 60 * 60 * 24, | |
} | |
def time_to_seconds(pattern, target, multipliers={}): |
OlderNewer