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 | |
import os | |
import re | |
import shutil | |
from os.path import splitext | |
SOURCE = os.getcwd() + "/www/" | |
TARGET = os.getcwd() + "/compiled/" | |
if not os.path.exists(TARGET): |
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
package web | |
import ( | |
"bytes" | |
"reflect" | |
"regexp" | |
"fmt" | |
"errors" | |
"strings" | |
) |
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
Tweaks to Intellij: | |
Load Golang SDK | |
Mark Golang SDK as default | |
--- | |
Keyboard Shortcuts: | |
Go to end of file |
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 sys | |
class Logger(object): | |
""" | |
Write log messages to the console (sys.stdout) and to a log file, | |
all managed as a context manager: | |
>>> with Logger('log_file.txt'): | |
... print "Hello, World!" # goes to stdout and to the log file |
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 first_letter_mnemonic(text): | |
words = text.split() | |
letters = [] | |
for word in words: | |
letters.append(word[0]) | |
if word[-1] in ',-': # inline punctuation | |
letters.append(word[-1]) | |
elif word[-1] in '.;:?!': # delimiting punctuation |
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
// NOTE: This is examples code which never actually became valid because we found a better way. | |
func TestScoring(t *testing.T) { | |
Convey("Subject: Bowling Game Scoring", t, func(c Context, so Assertion) { | |
var game *Game // Whatever you do, don't do this: game := NewGame() | |
// Otherwise nested closures won't reference the correct instance | |
Convey("Given a fresh score card", c, func() { | |
game = NewGame() |
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
Show hidden characters
[ | |
{ "keys": ["super+k", "super+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}}, | |
{ "keys": ["super+k", "super+m"], "command": "toggle_minimap" }, | |
{ "keys": ["super+k", "super+t"], "command": "delete_trailing_spaces" } | |
] |
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
{ | |
"close_windows_when_empty": true, | |
"color_scheme": "Packages/Dayle Rees Color Schemes/sublime/darkside.tmTheme", | |
"draw_white_space": "all", | |
"font_face": "Source Code Pro", | |
"font_size": 19, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], |
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 Path(object): | |
""" | |
This nifty class uses dynamic attribute resolution to mimic a directory | |
tree on a file system (either real or contrived). | |
""" | |
def __init__(self, root, enforce_real_paths=False): | |
self.root___ = str(root) | |
self.navigation___ = [] | |
self.enforce___ = enforce_real_paths | |
if self.enforce___ and not os.path.exists(self.root___): |
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 main(): | |
print ' 42 in 32 bits:', bits(42, 32) | |
print '-42 in 32 bits:', bits(-42, 32) | |
print '-42 in 20 bits:', bits(-42, 20) | |
def bits(number, size_in_bits): | |
""" | |
The bin() function is *REALLY* unhelpful when working with negative numbers. |