(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# Dynamic configuration file inclusion example. | |
# This script is intended for demo purposes and home usage only. | |
# There are intentionally no any security checks. | |
import imp | |
import sys | |
if len(sys.argv) < 2: | |
print "Specify a configuration file to include" | |
exit(1) |
import feedparser | |
from time import mktime | |
from datetime import datetime | |
def format_datetime(struct_time): | |
return datetime.fromtimestamp(mktime(struct_time)) | |
def read_gist_feed(github_user): |
@echo off &python -x %0 %* &goto :eof | |
print("Hello Python!") |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
The first image version is a normal thread. Second one has redundant user names removed.
require 'pp' | |
WORDS = %w(correct horse battery staple) | |
LENGTH = 100 | |
SOURCE = (0..LENGTH).map { WORDS.sample } | |
puts "Source: #{SOURCE.join(', ')}" | |
### |
class Enum | |
def self.value(key, value = nil) | |
@enum ||= {} | |
@enum[key] = value || @enum.size | |
define_singleton_method(key) { @enum[key] } | |
end | |
def self.enum | |
@enum | |
end |
PID_FILE = 'pid.txt' |
PY2 = sys.version_info[0] == 2 | |
if not PY2: | |
strtype = str | |
chrtype = chr | |
else: | |
strtype = unicode | |
chrtype = unichr |