To use watchman, run watchman file-to-watch sleep-time command-to-execute
like so.
watchman test.txt 1 echo 'Tada!'
import time | |
import sound | |
from scene import * | |
class TeaTimer(Scene): | |
def setup(self): | |
self.initial_time = int(60 * 1.5) | |
self.remaining_time = self.initial_time | |
self.center_x = self.size.w * 0.5 |
To use watchman, run watchman file-to-watch sleep-time command-to-execute
like so.
watchman test.txt 1 echo 'Tada!'
from itertools import count | |
def filter(input, prime): | |
for i in input: | |
if i % prime: | |
yield i | |
def get_primes(num): | |
g = count(2) | |
for _ in xrange(num): |
>>> class Foo(object): | |
... # Immutable objects are fine as class attrs. | |
... mystr = 'a' | |
... myint = 1 | |
... mytpl = (1,) | |
... | |
... # But mutable objects often surprise you. | |
... mylst = [] | |
... mydct = {} | |
>>> foo = Foo() |
web: gunicorn -w4 -b0.0.0.0:$PORT app:app |
import django | |
DEBUG, ROOT_URLCONF, DATABASES, SECRET_KEY = 1, 'pico', {'default': {}}, 'p' | |
urlpatterns = [django.conf.urls.url(r'^(?P<name>\w+)?$', lambda request, | |
name: django.http.HttpResponse('hello %s!' % (name or 'world')))] |
#!/usr/bin/env python2.6 | |
""" | |
A quick script to install into your `Application Support/BBEdit/Scripts` folder. | |
This runs PyFlakes (requires PyFlakes to be installed at `/usr/local/bin` - | |
try ``/usr/bin/easy_install-2.6 pyflakes==0.4.0``) and reformats the results | |
so that they show up in BBEdit's search results / error / warnings window. Then | |
the errors can be stepped through one at a time. | |
I've bound this to control-shift-V. You must save your Python file first before | |
running the check. |
Looking at projects that are good candidates for being re-written in rust / webassembly!
https://www.npmjs.com/package/moment-timezone
could build off work in rust: https://github.com/chronotope/chrono
# Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
# Original author: udfalkso | |
# Modified by: Shwagroo Team and Gun.io | |
# Further modified by: Jakub Skalecki (https://rock-it.pl) | |
import hotshot | |
import hotshot.stats | |
import textwrap | |
import os |
from django import forms | |
from django.core.exceptions import ValidationError | |
from django.db import transaction | |
class InvalidInputsError(Exception): | |
def __init__(self, errors, non_field_errors): | |
self.errors = errors | |
self.non_field_errors = non_field_errors |