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
tell application "Safari" | |
set _source to do JavaScript "window.document.documentElement.outerHTML" in document 1 | |
set _name to name of document 1 | |
end tell | |
tell application "BBEdit" | |
make new text window with properties ¬ | |
{contents:_source, source language:"HTML", name:"Generated source: " & _name} | |
select insertion point before character 1 of text window 1 |
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
# Adapted from http://appengine-cookbook.appspot.com/recipe/lazy-loading-webapp-handler/ | |
def _istring(import_name): | |
"""Imports an object based on a string. | |
@param import_name the dotted name for the object to import. | |
@return imported object | |
""" | |
module, obj = import_name.rsplit('.', 1) | |
# __import__ can't handle unicode strings in fromlist if module is a package | |
if isinstance(obj, unicode): |
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
"""Yet Another Python Templating Utility, Version 1.2, by Alex Martelli. | |
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52305 | |
(Specialized to HTML and modified by Peter Norvig.) | |
Copies input to output, with some substitutions. There are three types | |
of substitutions: lexical, expression, and statement. | |
LEXICAL SUBSTITUTIONS: | |
& < > |
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 os | |
import sys | |
import re | |
import yaml | |
from new import classobj | |
""" | |
Yaml file looks like this - | |
Class: |
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 | |
# | |
# HTTP Decorators Plugin provides some HTTP decorators for your controller actions | |
# Usage: | |
# 1) Import the decorators ("from plugins.http_decorators import *") | |
# 2) Annotate your action. Example: To allow only GET-requests to the action 'myaction': | |
# @http_get_method_only | |
# def myaction(self): | |
# pass | |
# |
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
# | |
# bon clarice, comme dans beaucoup de programme, nous avons de variables, | |
# des fonctions avec boucles et conditions, et une fonction principale. | |
# d'abord deux variables, globales dans ce cas. | |
# elles sont des listes, une est vide, l'autre pas. | |
ptichoux = [] | |
ouf = [ 'houga houga', |
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 cgi | |
import os | |
from google.appengine.ext.webapp import template | |
from google.appengine.api import users | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
from google.appengine.ext import db | |
from google.appengine.api import memcache | |
from google.appengine.api import urlfetch |
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
# based on http://amix.dk/blog/post/19574 | |
from datetime import datetime, timedelta | |
GRAVITY = 0.5 # HN default: 1.8 | |
WINDOW = 36 # max age in hours | |
now = datetime.now() | |
def hours_from_dt(dt): |
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
# http://stackoverflow.com/questions/748324/python-convert-those-tinyurl-bit-ly-tinyurl-ow-ly-to-full-urls | |
############# | |
# urllib2 | |
import urllib2 | |
fp = urllib2.urlopen('http://bit.ly/rgCbf') | |
fp.geturl() | |
# ==> 'http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place' |
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
type ApacheLogRecord struct { | |
http.ResponseWriter | |
ip string | |
time time.Time | |
method, uri, protocol string | |
status int | |
responseBytes int64 | |
elapsedTime time.Duration | |
} |
OlderNewer