start new:
tmux
start new with session name:
tmux new -s myname
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#!/usr/bin/env python | |
import unittest | |
import sys | |
class FizzBuzz: | |
def fizz(self, i): | |
try: | |
0 / (i % 3) | |
return self.buzz(i) | |
except ZeroDivisionError: |
jQuery.fn.replaceText = function( search, replace, text_only ) { | |
return this.each(function(){ | |
var node = this.firstChild, | |
val, | |
new_val, | |
remove = []; | |
if ( node ) { | |
do { | |
if ( node.nodeType === 3 ) { | |
val = node.nodeValue; |
TEST_INDEX = { | |
'default': { | |
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', | |
'URL': 'http://127.0.0.1:9200/', | |
'TIMEOUT': 60 * 10, | |
'INDEX_NAME': 'test_index', | |
}, | |
} | |
#/bin/sh | |
OPTS=$(getopt -o cehw: --long config:,expire-limit:,help,webservice: -n "$0" -- "$@") | |
if [ $? != 0 ]; then | |
echo "Terminating ..." >&2 | |
exit 1 | |
fi | |
CONFIG=/etc/letsencrypt/cli.ini | |
WEBSERVICE=nginx |
import random | |
class TicTacToe: | |
def __init__(self, playerX, playerO): | |
self.board = [' ']*9 | |
self.playerX, self.playerO = playerX, playerO | |
self.playerX_turn = random.choice([True, False]) | |
def play_game(self): |
[ | |
{name: 'Afghanistan', code: 'AF'}, | |
{name: 'Åland Islands', code: 'AX'}, | |
{name: 'Albania', code: 'AL'}, | |
{name: 'Algeria', code: 'DZ'}, | |
{name: 'American Samoa', code: 'AS'}, | |
{name: 'AndorrA', code: 'AD'}, | |
{name: 'Angola', code: 'AO'}, | |
{name: 'Anguilla', code: 'AI'}, | |
{name: 'Antarctica', code: 'AQ'}, |
The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 29 Jul 2015 01:52:41 GMT till Fri, 29 Jul 2016 01:52:41 GMT.
Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:
githubUsers
.filter(user => user.followers > 6)
#!/usr/bin/python | |
import sys | |
import json | |
data = sys.stdin.read() | |
json_data = json.loads("".join(data)) | |
json_string = json.dumps(json_data, sort_keys=True, indent=4, ensure_ascii=False) | |
print(json_string) |