There are a lot of really great snippets of wisdom available on the internet for building and designing beautiful and friendly software. My goal is to collect as much of it as possible right here.
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
// Facebook Profile Getter | |
// From Friend List | |
JSON.stringify(Array.prototype.slice.call($$('._698 img')).map(function (el) { | |
var parts = el.src.match(/(.*?\.net\/.*?)\/.*?\/([0-9]+_[0-9]+_[0-9]+_s\.jpg)/i); | |
return parts && [parts[1], parts[2].replace('s', 'n')].join('/'); | |
})); | |
// From Photos | |
JSON.stringify(Array.prototype.slice.call($$('._6i9 .tagWrapper i')).map(function (el) { | |
var url = el.style.background.match(/url\((.*?)\)/), | |
parts = url[1] && url[1].match(/(.*?\.net\/.*?)\/.*?\/([0-9]+_[0-9]+_[0-9]+_n\.jpg)/i); |
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
-record(myopaque, {udata, | |
times = 0, | |
foobar}). | |
out(A) -> | |
H = A#arg.headers, | |
C = H#headers.cookie, | |
case yaws_api:find_cookie_val("baz", C) of | |
[] -> | |
M = #myopaque{}, |
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
try: | |
from functools import update_wrapper | |
except ImportError: | |
from django.utils.functional import update_wrapper # Python 2.3, 2.4 fallback. | |
from django.contrib.auth.decorators import _CheckLogin | |
def login_not_required(view_func): | |
""" | |
Decorator which marks the given view as public (no login required). |
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
# -*- coding: utf-8 -*- | |
""" | |
rcombinations.py | |
~~~~~~~~~~~~~~~~ | |
Implements different a restricted combination function. | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or |
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
# -*- coding: utf-8 -*- | |
class tail_recursive(object): | |
""" | |
Based on comments on this active state recipe: <http://code.activestate.com/recipes/496691/> | |
""" | |
def __init__(self, func): | |
self.func = func | |
self.firstcall = True | |
self.CONTINUE = object() |
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
<?xml version="1.0"?> | |
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | |
<service_bundle type="manifest" | |
name="export"> | |
<service name="application/gogs" | |
type="service" | |
version="1"> | |
<create_default_instance enabled="false" /> | |
<single_instance /> | |
<dependency name="network" |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Takes an arbitrary number of command line arguments and randomly selects one | |
to return. The amount of entropy involved can be adjusted by setting the | |
environment variable ```RANDBYTES```, which defaults to 4096. | |
""" | |
from __future__ import print_function |
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
# -*- coding: utf-8 -*- | |
""" | |
Case-Insensitive ModelBackend | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any |
OlderNewer