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
<html> | |
<body> | |
<canvas id="canvas1" width="200" height="200"></canvas> | |
<canvas id="canvas2" width="200" height="200"></canvas> | |
<canvas id="canvas3" width="200" height="200"></canvas> | |
<script> | |
var canvases = [canvas1, canvas2, canvas3] | |
var fillArgs = [undefined, 'evenodd', 'nonzero'] |
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 socket | |
# see wsgiref.simple_server for a real implementation of a WSGI server | |
def serve(app): | |
listener = socket.socket() | |
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
listener.bind(('', 8080)) | |
listener.listen(5) | |
while True: | |
s, addr = listener.accept() |
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
module Main exposing (..) | |
type alias HasXAndY a = | |
{ a | x : Float, y : Int } | |
type alias HasX a = | |
{ a | x : Float } |
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
from typing import Callable | |
class A: pass | |
class B: pass | |
class C: pass | |
def composition(aToB: Callable[[A], B], | |
bToC: Callable[[B], C]) -> Callable[[A], C]: | |
"""Returns a callable that takes an A and returns a C""" |
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
a simple remix file format | |
Files are always UTF-8 | |
a syntax like | |
episode <episode query> of <podcast url> | |
play from <time> to <time> [at 2x speed] [at +12 dB] | |
example: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
tomb@localhost:~$ strace python myPythonScript.py 2>&1 >/dev/null | grep open | grep -v ENOENT | grep -o '".*"' | grep -v '\.pyc' | |
"/etc/ld.so.cache" | |
"/lib/x86_64-linux-gnu/libpthread.so.0" | |
"/lib/x86_64-linux-gnu/libc.so.6" | |
"/lib/x86_64-linux-gnu/libdl.so.2" | |
"/lib/x86_64-linux-gnu/libutil.so.1" | |
"/lib/x86_64-linux-gnu/libz.so.1" | |
"/lib/x86_64-linux-gnu/libm.so.6" | |
"/usr/lib/python2.7/site.py" | |
"/usr/lib/python2.7/os.py" |
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
"""An immutable Tic Tac Toe board and minimax ai""" | |
import itertools | |
class Board(object): | |
"""Immutable Tic Tac Toe board | |
>>> Board().rows | |
((' ', ' ', ' '), (' ', ' ', ' '), (' ', ' ', ' ')) | |
>>> print Board() | |
| | |
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 | |
# Add the line | |
# pastebin_helper = opt.py | |
# to .bpython/config | |
# under a section called | |
# [general] | |
# to enable | |
import sys | |
import urllib |
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 Class | |
alias :create :new | |
@@objects = [] | |
def new(*a, &b) | |
obj = allocate | |
if obj.class == String | |
nil | |
elsif obj.class == Time |