Skip to content

Instantly share code, notes, and snippets.

@jesseincn
jesseincn / gist:d0cbd2dddadfd3c91eb0
Last active August 29, 2015 14:06
批量清除目录下的文件BOM头clearbom.php
<?php
if (isset($_GET['dir'])){ //设置文件目录
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
function checkdir($basedir){
if ($dh = opendir($basedir)) {
@jesseincn
jesseincn / gist:54c12f7a75ae25a44452
Created September 24, 2014 14:25
微信 根据当前地理位置经纬度计算1000米以内的经纬度范围 php版
$myLat = $postObj->Location_X;//接收到的当前位置的纬度
$myLng = $postObj->Location_Y;//接收到的当前位置的经度
$Label = $postObj->Label;//接收到的当前地理位置信息
$Label = iconv("UTF-8","GBK",$Label);
$find = stripos($Label,' ');//过滤掉邮政编码 纯属为了整洁性
if($find!==false)
{
$Label = substr($Label,0,$find);
}
@jesseincn
jesseincn / gist:66186c633c26695bcd96
Created October 15, 2014 02:53
手机端页面头信息
<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
<title></title>
</head>
@jesseincn
jesseincn / gist:581f489c16aca7fc8c75
Created October 27, 2014 06:28
页面预加载提示页
//获取浏览器页面可见高度和宽度
var _PageHeight = document.documentElement.clientHeight,
_PageWidth = document.documentElement.clientWidth;
//在页面未加载完毕之前显示的loading Html自定义内容
var _LoadingHtml = '<div id="loadingDiv" style="position:fixed;left:0;width:100%;height:100%;top:0;background:#2baed0;z-index:10000;"><div id="loading" style="position:fixed;top:50%;left:50%;width:100px;height:140px;overflow:hidden;background:url('+base_url+'data/template/project/images/load.gif) no-repeat;background-size:100% 100%;z-index:7; margin:-70px 0 0 -50px;"><img src="'+base_url+'data/template/project/images/logo3.png" style="width:60px;margin-top:40px;margin-left:22px;" /></div><div style="position:absolute;width:80%;text-align:center;left:10%;top:70%;color:#fff;border:1px dashed #fff;height:40px;line-height:40px;border-radius:4px;font-size:16px;">善待你一生 for you forever</div></div>';
//呈现loading效果
document.write(_LoadingHtml);
//监听加载状态改变
document.onreadystatechange = completeLoading;
@jesseincn
jesseincn / gist:aa00593b4c8639cd306a
Created October 28, 2014 13:04
JavaScript转换时间戳
function date (format, timestamp) {
// Format a local date/time
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/date
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
// + parts by: Peter-Paul Koch (http://www.quirksmode.org/js/beat.html)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: MeEtc (http://yass.meetcweb.com)
// + improved by: Brad Touesnard
@jesseincn
jesseincn / gist:2f58df80ecb8bc2fa55a
Created October 30, 2014 10:53
mac os 下安装oracle 客户端
http://blog.csdn.net/remote_roamer/article/details/8165690
1. 访问Oralce 的官网,下载相关压缩包
http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
注意:在mac 山狮操作系统下,要下载x86 即 32位版本。不能用 64位的。否则 navicat 也不能使用
用navicat 连数据库 请 参考 http://wiki.navicat.com/wiki/index.php/Instant_client_required
@jesseincn
jesseincn / gist:2ec563ea0af452421005
Created December 1, 2014 03:49
微信wap开发-页面自适应大小
<meta name="viewport" content="width=device-width, initial-scale=0.5, minimum-scale=0.3, maximum-scale=2.0, user-scalable=yes" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
1. 使用HTML中的viewport来实现
viewport语法如下:
@jesseincn
jesseincn / gist:4d836cdd13079cc1dd91
Last active August 29, 2015 14:10
IIS7.5配置php5.3并扩展支持伪静态Rewrite
### 参考文档:
IIS7.5 配置 PHP 5.3.5:
http://www.cnblogs.com/Ryan_j/archive/2011/03/19/1988973.html
IIS伪静态组件(支持多站点) ISAPI_Rewrite3完全版:
http://www.jb51.net/softs/41171.html
### 详细步骤说明:
一、安装PHP
1. 首先确认IIS中启用了CGI功能:
@jesseincn
jesseincn / gist:94fa6576861b9cfec95e
Last active August 29, 2015 14:11
[某些邮箱会发送失败]Codeigniter框架使用SMTP协议发送邮件
/**
* SMTP发送邮件
* 1.确认开启PHP扩展php_sockets.dll
*
* @param $from 发件人email地址
* @param $from_name 发件人名称
* @param $to 收件人email地址,可以是单个、一个以逗号分隔的列表或是一个数组
* @param string $subject 主题
* @param string $message 正文部分
* @param string $attach 附件
@jesseincn
jesseincn / gist:fcf7a0a0a9ed92ee814d
Created December 12, 2014 10:31
PhpExcel中文帮助手册|PhpExcel使用方法
下面是总结的几个使用方法
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
//或者include 'PHPExcel/Writer/Excel5.php'; 用于输出.xls的
创建一个excel
$objPHPExcel = new PHPExcel();
保存excel—2007格式
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
//或者$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); 非2007格式
$objWriter->save("xxx.xlsx");