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
/* | |
*假设有2个函数firstFunction和secondFunction需要在网页加载完毕时执行, 需要绑定到window。onload。如果通过: | |
* | |
* window.onload = firstFunction; | |
* window.onload = secondFunction; | |
* 结果是只有secondFunction会执行,secondFunction会覆盖firstFunction。 | |
*/ | |
/* | |
*正确的方式是: |
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
/*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) |
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 -*- | |
import MySQLdb | |
import sys | |
def mysqlFunc(): | |
try: |
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
#!/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 |
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 -*- | |
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) |
OlderNewer