Skip to content

Instantly share code, notes, and snippets.

View lbj96347's full-sized avatar

lbjhk lbj96347

View GitHub Profile
@lbj96347
lbj96347 / JsBubbleSort.js
Created April 30, 2012 17:24
Javascript Bubble Sort
//Javascript 冒泡排序,我把1000个随机数进行无序写入数组后,进行冒泡排序,观察浏览器运算使用时间
//if your browser support Date.now(), You can use Date.now() to get the current time
SortHelper = {
  BubbleSort: function(array,time1) {
    length = array.length;
    for(i=0; i<=length-2; i++) {
      for(j=length-1; j>=1; j--) {
        if(array[j] < array[j-1]) {
          temp = array[j];
@lbj96347
lbj96347 / jstimechecking.js
Created May 3, 2012 08:19
Js time checking
/*
* 检查数据库时间离现在多久远了
* 加载该js文件
* 传入参数 dbtime
* example : var dbtime = '2012-04-08 15:57:07';
* 运行函数 getTimeCheck(dbtime)
* 最后输出变量getTimeCheck
* 20120916更新-使用继承的方式来输出结果值(尾部是demo,自行去掉demo使用)
*
*/
@lbj96347
lbj96347 / phpXMLNoCdata.php
Created May 6, 2012 10:05
php load xml nocdata
<?php
$url = "http://api.hudong.com/dict.do?title=5%E6%9C%882%E6%97%A5&from=perhaps&type=63&appkey=asdfasf341";
$xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
?>
@lbj96347
lbj96347 / YahooWeatherTranslate.json
Created May 12, 2012 02:09
Yahoo Weather En To Zh
{"yahooWeather":[{"condition":"tornado","zh":"龙卷风"},{"condition":"tropical storm","zh":"热带气旋"},{"condition":"hurricane","zh":"台风/飓风"},{"condition":"severe thunderstorms","zh":"强雷暴"},{"condition":"thunderstorms","zh":"雷暴"},{"condition":" mixed rain and snow","zh":"雨夹雪"},{"condition":"mixed rain and sleet","zh":"冻雨"},{"condition":"mixed snow and sleet","zh":"冻雨夹雪"},{"condition":"freezing drizzle","zh":"冻毛毛雨"},{"condition":"drizzle","zh":"毛毛雨"},{"condition":"freezing rain","zh":"冻雨"},{"condition":"showers","zh":"阵雨"},{"condition":"showers","zh":"阵雨"},{"condition":"snow flurries","zh":"飘雪"},{"condition":"light snow showers","zh":"短暂小雪"},{"condition":"blowing snow","zh":"风雪"},{"condition":"snow","zh":"有雪"},{"condition":"hail","zh":"冰雹"},{"condition":"sleet","zh":"冻雨"},{"condition":" dust","zh":"灰尘"},{"condition":"foggy","zh":"有雾"},{"condition":"haze","zh":"阴霾"},{"condition":"smoky","zh":"有烟雾"},{"condition":"blustery","zh":"大风"},{"condition":" windy","zh":"有风"},{"condition":"cold","zh":"寒冷"},{"condition":"cloudy"
@lbj96347
lbj96347 / phpBubbleSort.php
Created May 12, 2012 17:36
php Bubble Sort
<?php
//print_r(time());
function make_array(){
$one_array = array();
for( $i = 1 ; $i < 5000 ; $i++){
$rand_num = rand(0, 5000);
$one_array[$i] = $rand_num;
if ( $i == 1 ){
$time1 = time();
@lbj96347
lbj96347 / pyBubbleSort.py
Created May 13, 2012 11:54
python bubble sort
#python bubble test
def make_array():
define_array = [ i for i in range(0, 5000) ]
for x in range(0, 5000):
import random
@lbj96347
lbj96347 / tencent_weibo_post_pic_t.php
Created July 4, 2012 05:24
tencent weibo pic & t share
<?php
//腾讯微博,分享微博加图片
if($url){
//$ext=substr($url, -3,3);
$ext=strrchr($url,".");
//查找'.'字符串出现的位置
$filename=date("YMDHis").$ext;
//定义文件名字为日期+网址
$exName = strtolower(substr($filename,(strrpos($filename,'.')+1)));
//文件名字,去掉文件格式
@lbj96347
lbj96347 / sha1_javascript_library.js
Created July 11, 2012 09:58
sha1_javascript_library
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS PUB 180-1
* Version 2.1-BETA Copyright Paul Johnston 2000 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
@lbj96347
lbj96347 / WebAppTouchBlink.html
Created August 5, 2012 11:45
Web App Touch Blink
@lbj96347
lbj96347 / Phonegap_AppDelegate.m
Created August 14, 2012 09:09
Phonegap_AppDelegate_Config
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0