- Xander
- Saman
- Erica
- Casey
- Cailey
class MyAPINotAvailable < StandardError | |
attr_accessor :message | |
def initialize(message) | |
@message = "Failed to connect to MyAPI: #{message}" | |
end | |
end | |
raise MyAPINotAvailable.new "Could not update Foo" |
class composable: | |
def __init__(self, func): | |
self.func = func | |
def __call__(self, *args, **kwargs): | |
return self.func(*args, **kwargs) | |
def __or__(self, other): | |
return lambda *args, **kwargs: self(other(*args, **kwargs)) | |
from tests import factories | |
from website import models | |
from website.util import web_url_for | |
from main import app | |
def print_merge_url(user, token, prefix): | |
with app.test_request_context(): | |
print(prefix + ": " + | |
web_url_for( | |
'confirm_email_get', |
{ | |
"tasks": [ | |
{ "id": 1, "text": "my text 1" }, | |
{ "id": 2, "text": "my text 2" }, | |
{ "id": 3, "text": "my text 3" }, | |
{ "id": 4, "text": "my text 4" } | |
] | |
} |
alert('foo'); |
-
There once was a developer who had a problem. They decided to solve this problem using a regex. That developer now has two problems.
-
All problems in computer science can be solved through additional layers of abstraction.
#### Template (proposed, unnamed language) | |
doctype(5) | |
html>head | |
style('my_stylesheet.css') | |
script('my_script.js') | |
title= {{ title }} | |
body>div.container | |
navbar(main_menu_links) |
I'm a Python programmer and frequently work with the excellent [virtualenv][] tool by Ian Bicking.
Virtualenv is a great tool on the whole but there is one glaring problem: the activate
script that virtualenv provides as a convenience to enable its functionality requires you to source it with your shell to invoke it. The activate
script sets some environment variables in your current environment and defines for you a deactivate
shell function which will (attempt to) help you to undo those changes later.
This pattern is abhorrently wrong and un-unix-y. activate
should instead do what ssh-agent
does, and launch a sub-shell or sub-command with a modified environment.