Skip to content

Instantly share code, notes, and snippets.

View codeachange's full-sized avatar

noname codeachange

View GitHub Profile
@codeachange
codeachange / phpexcel applyfromarray.php
Last active August 3, 2019 08:20
phpexcel 批量修改样式 applyFromArray 数组规则
<?php
/*** PHPExcel Object ***/
/* Get the default Style object */
(PHPExcel_Style) $style = ((PHPExcel) $excel)->getDefaultStyle()
/*** PHPExcel_Cell Object ***/
/* Get the Style object for a Cell */
@codeachange
codeachange / mobile_reinit.php
Created March 14, 2016 14:53
手机重装步骤、要安装的软件
<?php
// 重装前备份项目
1、相册 -> 百度云
2、通讯录、便签等 -> 小米账号
// 重装后
1、安装百度离线地图
// 所有软件
@codeachange
codeachange / my-sublime-text-settings.php
Last active June 10, 2017 03:26
my sublime text settings
<?php
1, install package control
https://packagecontrol.io/installation
2, install packages
ProjectManager
All Autocomplete
ApacheConf.tmLanguage
BracketHighlighter
@codeachange
codeachange / debug.class.php
Created February 25, 2016 05:13
debug class for php
<?php
define('DEBUG_LOG_FILE',__DIR__.'/debuglog.html');
class debug{
static function log($str){
file_put_contents(DEBUG_LOG_FILE,self::prepare_str($str));
}
static function add($str){
@codeachange
codeachange / iframe-image.js
Last active November 15, 2015 13:45
把img替换为iframe,破解防盗链
function iframeImg(imgSelector){
var frameStr = '<iframe style="display:inline-block;width:100%;height:100%;border:0 none;"></iframe>';
/*jslint scripturl: true*/
var frameSrc = 'javascript:\'<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /><style>html,body{width:100%;height:100%;padding:0;margin:0;line-height:0;}</style></head><body></body></html>\';';
$(imgSelector).each(function (){
var imgSrc = this.src;
var iframe = $(frameStr).load(function (){
$('<img style="max-width:100%;">').load(function (){
iframe.css({width: this.width, height: this.height});
}).appendTo(iframe[0].contentWindow.document.body).attr('src', imgSrc+'?_t='+Math.random());
@codeachange
codeachange / js_html_encode_decode_from_wechat.js
Created November 15, 2015 11:54
微信公众号文章页面的 javascript encode/decode html
String.prototype.html = function(encode) {
var replace =["&#39;", "'", "&quot;", '"', "&nbsp;", " ", "&gt;", ">", "&lt;", "<", "&amp;", "&", "&yen;", "¥"];
if (encode) {
replace.reverse();
}
for (var i=0,str=this;i< replace.length;i+= 2) {
str=str.replace(new RegExp(replace[i],'g'),replace[i+1]);
}
return str;
};
@codeachange
codeachange / show_request.py
Created October 14, 2015 10:19
测试用,把 request 里的各种变量格式化后返回
#coding:utf-8
# 测试用,把 request 里的各种变量格式化后返回
def show_request():
request_dict = {}
request_dict['forms'] = {}
for item in request.forms:
request_dict['forms'][item] = request.forms.getall(item)
request_dict['query'] = {}
@codeachange
codeachange / mysql_backup_to_dropbox.php
Created July 8, 2014 14:53
back up mysql databases to dropbox
<?php
// https://github.com/jakajancar/DropboxUploader
require_once './DropboxUploader.php';
// dump mysql file
$myUser = 'root';
$myPass = 'root';
$myHost = 'localhost';
$myDbs = array('db1', 'db2');
@codeachange
codeachange / copy_sqlite_db
Created April 27, 2014 06:38
android copy sqlite database
File dbPath = getDatabasePath("taobaoclient.db");
if (!dbPath.exists()) {
try {
InputStream is = getAssets().open("databases/taobaoclient.db");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
FileOutputStream fos = new FileOutputStream(dbPath);