Apple's wireless keyboard built entirely using css3. I could use code for the background, but currently gradients have really ugly banding. Regardless, enjoy! (:
A Pen by Dustin Cartwright on CodePen.
# ! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
class Pair: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def __repr__(self): | |
return 'Pair({0.x!r}, {0.y!r})'.format(self) |
#!/bin/sh | |
# | |
# /etc/rc.d/init.d/supervisord | |
# | |
# Supervisor is a client/server system that | |
# allows its users to monitor and control a | |
# number of processes on UNIX-like operating | |
# systems. | |
# | |
# chkconfig: - 64 36 |
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import MySQLdb | |
import sys | |
def mysqlFunc(): | |
try: |
/*JaavaScript DOM 只提供了insertBefore方法: | |
* parentElement.insertBefore(newElement, targetElement) | |
* targetElement.parentNode.insertBefore(newElement, targetElement) | |
* 而没有提供insertAfter方法,可以利用DOM已有的属性和方法将其实现,如下。 | |
*/ | |
function insertAfter(newElement, targrtElement) | |
{ | |
var parent = targetElement.parentNode; | |
if (parent.lastChild == targetElement) |
/* | |
*假设有2个函数firstFunction和secondFunction需要在网页加载完毕时执行, 需要绑定到window。onload。如果通过: | |
* | |
* window.onload = firstFunction; | |
* window.onload = secondFunction; | |
* 结果是只有secondFunction会执行,secondFunction会覆盖firstFunction。 | |
*/ | |
/* | |
*正确的方式是: |
# ! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# 在MySQL中建立中文表名及中文字段名 | |
# MySQLdb 默认编码为 latin-1,改为utf-8 | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'root', 'root', 'testdb') | |
con.set_character_set('utf8') |
from jinja2 import Environment, FileSystemLoader | |
import os | |
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
env = Environment(loader=FileSystemLoader(CURRENT_DIR), trim_blocks=True) | |
template = env.get_template("template.xml") | |
# 利用数据(字典数据文件或 key-value对)渲染模板 | |
print template.render(taskData) |
# 加入如下代码片段, python2.7 默认为ascii编码,改为utf-8 | |
import sys | |
default_encoding = 'utf-8' | |
if sys.getdefaultencoding() != default_encoding: | |
reload(sys) | |
sys.setdefaultencoding(default_encoding) | |
outer_html = $('selector').clone().wrap('<p>').parent().html(); |
Apple's wireless keyboard built entirely using css3. I could use code for the background, but currently gradients have really ugly banding. Regardless, enjoy! (:
A Pen by Dustin Cartwright on CodePen.