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
{ | |
"// ": "------------------------------------------------------------------", | |
"// ": "JSON doesn't allow comments, so this is a very hacky workaround.", | |
"// ": [ "If you run into a situation where you need more than one line ", | |
"for a comment, you can use an array of strings to compensate ", | |
"for JSON's lack of support for multi-line strings.", | |
"(Credit to: https://stackoverflow.com/a/7744658)", | |
"And you can even have paragraph breaks for long comments.", |
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 HALResource(object): | |
"""A HAL Resource | |
Parameters | |
---------- | |
uri : Optional[str] | |
URI for the resource. | |
data : Optional[dict] | |
Cached data for this resource. |
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
// JavaScript does not do Tail-Call Optimization therefore the straight-forward | |
// recursive implementation blows up. | |
var plain_recursive_count = function (c, n, sum) { | |
if (c < n) { | |
return plain_recursive_count(c+1, n, sum+c+", "); | |
} | |
else { | |
return sum; | |
} |
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
# alarm_clock.py | |
from time import ctime, clock, sleep | |
import winsound | |
import sys | |
import msvcrt | |
def get_num_tadas_from_user(): | |
while True: | |
n = input("\nHow many tadas?> ") |
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 | |
#chessTimer.py | |
""" | |
Can be used as a substitute for a real chess timer. | |
Must be run at command line. | |
""" | |
import time | |
import msvcrt |
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 add_item_to_data(p): | |
with open("C:/P32Working/Data/phone_book.txt") as file: | |
keys_list = [line.partition('=')[0] for line in file] | |
while True: | |
file = open("C:/P32Working/Data/phone_book.txt", "a+") | |
new_item = input("Enter new item in form 'key=value' or enter 'q' to quit: ") | |
#if quit | |
if new_item in 'Qq': |
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
""" | |
Simple phone book app | |
(c) Nick Zarczynski | |
license: BSD | |
""" | |
import cPickle | |
from Tkinter import * | |
FILENAME = 'book.pk' |
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
;; I came across the FizzBuzz test for the nth time today and figured I'd write down some solutions in Chicken Scheme | |
;; Here's the Reddit link if anyone's interested http://www.reddit.com/r/programmingchallenges/comments/h21hc/challenge_fizzbuzz/ | |
;; Recursive | |
(define (fb n) | |
(if (< n 101) | |
(begin | |
(cond ((= (remainder n 15) 0) (print "FizzBuzz")) |
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 | |
############################################################################## | |
## If you would like to contribute, contact jacktradespublic@gmail.com | |
## | |
## tvtracker is free software: you can redistribute it and/or | |
## modify it under the terms of the GNU Affero General Public | |
## License version 3 as published by the Free Software Foundation. | |
## | |
## This program is distributed in the hope that it will be useful, | |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
""" | |
This method uses a class (cons) to represent and construct the cons cell | |
""" | |
class cons: | |
""" | |
To construct a new cons cell: | |
a = cons(1, 2) |