Skip to content

Instantly share code, notes, and snippets.

<?php
var_dump(mb_str_split('hello 小姐 韩语中字全集'));
var_dump(utf8_split('hello 小姐 韩语中字全集'));
var_dump(utf8_split_by_mb('hello 小姐 韩语中字全集'));
function utf8_split($str){
$bin11 = 0xC0;
$bin10 = 0x80;
<?php
/*
API Google URL Shortner
marcusnunes.com
*/
echo goo::get('http://www.baidu.com');
class goo{
function get($url){
$error = '';
<?php
/**
* pdo 的扩展类
* author: wjzhangq <[email protected]>
*/
class db implements ArrayAccess, Countable
{
protected $tables; //db中所有表
protected $pdo;
<?php
class Process {
//for parent
protected $resource; //process resource
public $pipes; //process pipes
public $php_path = 'php'; //system php path
public $script_path = ''; //运行j脚本
protected $start_time; //subproces start time
protected $no = 0; //subprocc no
public $name = ''; //subprocc name
/*
只依据纵向处理固定, 不支持已fixed的的dom, static to fixed
*/
var FixedLayer = function(id){
if(!id){ return; }
this.dom = document.getElementById(id);
if(!this.dom){ return; }
//设置固定点 只支持小于等与原位
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试fix浮动</title>
<style type="text/css">
.FixTop{z-index:10000;width:100%;height:24px;position:absolute;position:fixed;
bottom:0;right:0;text-align:center;background-color: gray;
_position:absolute;
_top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? (documentElement.scrollTop + documentElement.clientHeight - 24) : (document.body.scrollTop + document.body.clientHeight -24));
<?php
// 说明:PHP中二维数组的排序方法
// 整理:http://www.CodeBit.cn
/**
* @package BugFree
* @version $Id: FunctionsMain.inc.php,v 1.32 2005/09/24 11:38:37 wwccss Exp $
*
*
* Sort an two-dimension array by some level two items use array_multisort() function.
"""
Simple preforking echo server in Python.
"""
import os
import sys
import socket
# Create a socket, bind it to localhost:4242, and start
# listening. Runs once in the parent; all forked children
# code by 李嘉
# 禁止任何商业目的的转载
# 不对因使用代码产生任何后果负任何责任
# 转载请保留所有声明
import threading, time, httplib, random
# 需要测试的 url 列表,每一次的访问,我们随机取一个
urls = [
"/test?page=",
"/test2?orderby=a&page=",
"/test2?orderby=d&page=",
# -*- coding: utf-8 -*-
from Tkinter import *
def frame(root, side):
w = Frame(root)
w.pack(side=side, expand=YES, fill=BOTH)
return w
def button (root, side, text, command=None):
w = Button(root, text=text, command=command)