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
| ### Keybase proof | |
| I hereby claim: | |
| * I am nb on github. | |
| * I am nikolayb (https://keybase.io/nikolayb) on keybase. | |
| * I have a public key whose fingerprint is 5B90 5510 BE15 69CB 2D45 146F 9452 16AC 9610 D078 | |
| To claim this, I am signing this object: |
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
| it( 'should handle series of same component', function() { | |
| var expectedResultString = '<span><a href="#">baba</a><a href="#">dyado</a></span>', | |
| translatedComponent = translate( '{{link}}baba{{/link}}{{link}}dyado{{/link}}', { components: { link: link } } ); | |
| assert.equal( expectedResultString, stripReactAttributes( React.renderToString( translatedComponent ) ) ); | |
| } ); | |
| it( 'should handle wrong cross-nesting', function() { | |
| var expectedResultString = '', // how do we return error? | |
| translatedComponent = translate( '{{link}}a{{em}}b{{/link}}c{{/em}}', { components: { link: link, em: em } } ); | |
| assert.equal( expectedResultString, stripReactAttributes( React.renderToString( translatedComponent ) ) ); |
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
| # look for the ID of the `default` VM | |
| vagrant global-status | |
| vagrant ssh <default-id> | |
| # install nsenter | |
| docker run -v /usr/local/bin:/target jpetazzo/nsenter | |
| # get the container id, not the image id | |
| docker ps |
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 unittest | |
| def is_interval(interval, **kwargs): | |
| to_list = lambda value: [value] if isinstance(value, basestring) else value | |
| list_from_kwarg = lambda key: to_list(kwargs.get(key, [])) | |
| units = ['y', 'm', 'd', 'h', 'i', 's'] | |
| only = list_from_kwarg('only') | |
| if only: | |
| return is_interval(interval, with_ = only, without = list(set(units) - set(only))) | |
| with_ = list_from_kwarg('with_') |
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/env python | |
| import sys, shutil, os.path | |
| if len(sys.argv) != 3: | |
| sys.stderr.write('Usage: %s PLAYLIST DEST\n\n' % sys.argv[0]) | |
| sys.exit(1) | |
| exported, dest = sys.argv[1:] | |
| lines = unicode(open(exported).read(), 'utf16').split('\r')[1:] | |
| files = ['/Volumes/' + line.split('\t')[-1].replace(':', '/') for line in lines] | |
| for file in files: | |
| if os.path.exists(file) and os.path.isfile(file): shutil.copy(file, dest) |
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
| RewriteEngine On | |
| RewriteBase /baba/ | |
| RewriteRule ^$ ../trunk/$1?_config=baba [L,QSA] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ ../trunk/$1?_config=baba [L,QSA] |
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
| <?php | |
| require_once 'PHPUnit/Framework.php'; | |
| /** | |
| * Matches a php code string upon a template of tokens | |
| * | |
| * @param string $code String of php code. | |
| * @param string $template See the tests below for examples. | |
| * | |
| * @return array|false Associative array of all variables or false if no match was found |
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
| """ | |
| E=7 | |
| TALLET + | |
| SIGNAL | |
| ------ | |
| ELAINE | |
| """ | |
| letters = set('T A L L E T S I G N A L E L A I N E'.split()) | |
| assoc = {letter: None for letter in letters} |
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
| # coding: utf-8 | |
| import email, imaplib, chardet, pickle | |
| m = imaplib.IMAP4_SSL('imap.gmail.com', 993) | |
| m.login('nb@nikolay.bg', 'тринайсетзелениголиорангутанагонятгоркатапеперудка') | |
| m.select('&BD8ENQRCBDA- &BDcEMAQ0BDAERwQw-') # пета задача | |
| typ, data = m.search(None, 'ALL') | |
| essays = [] | |
| for num in data[0].split(): | |
| print 'Getting %s' % num |
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
| # coding: utf-8 | |
| from xmlrpclib import ServerProxy, Binary | |
| import pickle | |
| import re | |
| server = ServerProxy("http://path-to-not-so-random-wp-installtion/xmlrpc.php") | |
| essays = pickle.load(open('essays')) | |
| for essay in essays: | |
| try: | |
| match = re.search(r'<([^<>]+)>\s*$', essay['from']) |
OlderNewer