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
''' | |
terminal | |
-------- | |
A simple checkout simulator. | |
''' | |
class Terminal(object): | |
'''A "point of sale" terminal object.''' |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// initialize the tape with 30,000 zeroes | |
unsigned char tape[30000] = {0}; | |
// set the pointer to point at the left-most cell of the tape | |
unsigned char* ptr = tape; |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char* add_cell(char* tape, size_t *tape_size) { | |
char* tmp = (char*)realloc(tape, (++*tape_size) * sizeof(char)); | |
if (tmp == NULL) { | |
printf("FATAL: Could not reallocate tape memory!"); |
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
mport re | |
import os | |
import random | |
from irctk import Bot | |
_DEFAULT_CHAIN_LEN = 2 | |
_DEFAULT_WORD_RANGE = 26 | |
PUNCTUATION = '.\?|.!|.\.' | |
TALKATIVE = 0.3 |
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
;; weasel | |
(def TARGET "ME THINKS IT IS LIKE A WEASEL") | |
(def ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ ") | |
(def RATE 0.05) | |
(def rand-seed | |
"Generate a random seed as long as the target." | |
(take (count TARGET) (repeatedly #(rand-nth ALPHABET)))) |
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
diff --git a/test_classy/test_blueprints.py b/test_classy/test_blueprints.py | |
index 6ea0284..71f079c 100644 | |
--- a/test_classy/test_blueprints.py | |
+++ b/test_classy/test_blueprints.py | |
@@ -65,8 +65,10 @@ def test_bp_custom_http_method(): | |
resp = client.post("/basic/route3/") | |
eq_("Custom HTTP Method", resp.data) | |
+def test_bp_url_prefix(): | |
+ foo = Blueprint('foo', __name__) |
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 -*- | |
''' | |
rauth.request | |
------------- | |
Provides a wrapper around the requests.Request object for OAuth and Ofly | |
parameter injection. | |
''' | |
import time |
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
def request(self, | |
method, | |
uri, | |
access_token=None, | |
access_token_secret=None, | |
header_auth=False, | |
allow_redirects=False, | |
**kwargs): | |
'''Makes a proper OAuth 1.0/a request. |
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 -*- | |
''' | |
rauth.test_service | |
------------------ | |
Test suite for rauth.service. | |
''' | |
from base import RauthTestCase |
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
class OflyServiceTestCase(RauthTestCase, HttpMixin): | |
app_id = '000' | |
def setUp(self): | |
RauthTestCase.setUp(self) | |
self.authorize_url = 'http://example.com/authorize' | |
self.base_url = 'http://example.com/api/' | |
self.service = OflyService('000', |