Skip to content

Instantly share code, notes, and snippets.

View lbj96347's full-sized avatar

lbjhk lbj96347

View GitHub Profile
@lbj96347
lbj96347 / javascriptfadeeffect.js
Created March 6, 2012 14:21
Javascript Fade Effect
//how to use it?you just need to use this words : 'fadeEffect.init(theID,0)' or 'fadeEffect.init(theID,1);'
//*theID is which element you want to add the effect in.
//*the 0/1 is the Parameter for the effect.0 stands for Transparent;1 stands for Visible
//besides you should set opacity in your html tags
//怎样用它?你只要写这个语句就可以了: 'fadeEffect.init(theID,0)' 或者 'fadeEffect.init(theID,1);'
//0 或者 1 这个这个效果的参数。0代表透明,1代表可见。
//此外,建议你再你的html标签里面设定好初始值
fadeEffect=function(){
return{
@lbj96347
lbj96347 / jsScrollupEffect.js
Created March 6, 2012 14:32
Javascript ScrollUp Effect
function scrollUp(nowHeight,scrollHeight) {
//window scroll animation
function moveScroller(){
function outPut(arg){
window.scrollTo(0,arg);
}
for(var i = nowHeight; i <= scrollHeight; i++){
setTimeout((function(pos){
return function(){ outPut(pos); }
})(i), i * 2);
@lbj96347
lbj96347 / StringToJSON.html
Created March 14, 2012 09:50
StringToJSON
<!-- 今天搜集了一下google weather的all condition,然后要把这些数据翻译成为中文,然后把这些固定的文字保存下来,打算用json格式。无奈的是这些字符串毫无规律,于是就想到了用正则去匹配,生成一段json代码。 -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>一段正则函数方便转换纯字符串为json</title>
</head>
@lbj96347
lbj96347 / JsAudioControl.html
Created March 24, 2012 08:04
JavascriptAudioControl
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Audio Player </title>
<!-- Uncomment the following meta tag if you have issues rendering this page on an intranet site. -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=9"/> -->
<script type="text/javascript">
// Global variable to track current file name.
var currentFile = "";
@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 / jsKeyCode.txt
Created May 1, 2012 13:31
javascript Key Code
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
@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();