Skip to content

Instantly share code, notes, and snippets.

@imzhi
imzhi / Alignment Key Bindings - User
Last active November 28, 2019 02:49
Sublime Text 3 配置(19-11-28更新)
[
{
"keys": ["ctrl+alt+shift+a"],
"command": "alignment"
},
{ "keys": ["alt+/"], "command": "auto_complete" },
{ "keys": ["alt+/"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
@imzhi
imzhi / .vimrc
Last active August 18, 2016 08:09
.vimrc 加强配置
"""""""""""""""""""""""""""""""""
" Refer to https://github.com/amix/vimrc
"""""""""""""""""""""""""""""""""
let g:isWindows = has('win32') || has('win64')
let g:isGUI = has('gui_running')
set nocompatible " be iMproved
filetype off " required!
if g:isWindows
#UPDATE:2013-12-07 12:16
127.0.0.1 localhost
#SmartHosts START
#Google Services START
203.208.46.200 0.docs.google.com
203.208.46.200 0.drive.google.com
203.208.46.200 1.docs.google.com
@imzhi
imzhi / ContactMaterial.html
Last active August 29, 2015 14:14
P2.JS 学习备忘
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>ContactMaterial</title>
<style type="text/css">
html,body{
margin:0;
padding:0;
overflow: hidden;
@imzhi
imzhi / CnblogsWz.js
Last active March 28, 2016 16:17
书签 - 博客园收藏
// 结尾增加void(0),适配Fx
javascript: ~function() {
var e = encodeURIComponent;
open("http://wz.cnblogs.com/create?t=" + btoa(unescape(e(document.title))) + "&u=" + e(location.href) + "&c=&i=0&base64=1", "_blank", "width=460,height=350");
}();void(0);
@imzhi
imzhi / 风之动漫键盘翻页插件.js
Created March 27, 2015 14:19
风之动漫键盘翻页插件
// ==UserScript==
// @name 风之动漫键盘翻页插件
// @namespace http://your.homepage/
// @version 0.1
// @description 风之动漫键盘翻页插件,左右键控制漫画翻页
// @author imzhi
// @match http://manhua.fzdm.com/*
// @grant none
// ==/UserScript==
@imzhi
imzhi / js_page.js
Last active August 29, 2015 14:22
js 分页。类似这种(前展示3页,后展示3页),5 6 7 [8] 9 10 11
/**
* 页码显示插件
* @author imzhi
* @date 2015-06-01
*
* @param total 总条数
* @param per 每页条数
* @param current 当前页码
* @return {string} str 返回页码字串
*/
@imzhi
imzhi / five2pair.php
Created July 22, 2015 06:03
四舍六入五成双
<?php
function five2pair($number)
{
$num_str = strval($number);
if (!strpos($num_str, '.')) $num_str .= '.';
list($int, $dec) = explode('.', $num_str);
$new_num = floatval( $int . '.' . substr($dec, 0, 2) );
if (isset($dec{2})) {
@imzhi
imzhi / twitter-proxy.md
Last active November 23, 2022 04:28 — forked from JingwenTian/twitter-proxy.md
nginx反代twitter完整镜像 (原文:http://jude.me/2014/10/04/twitter-mirror-2.html

示例

需要注意的几点

  • content-security-policy这个header要去掉,或者重写进你自己的域名,不然有些浏览器不会加载外部的元素
  • 使用proxy_cookie_domain替换cookies的作用域。twitter返回的cookies作用域是.twitter.com,也就是twitter.com的所有二级域名都可以调用,为使用者的安全考虑建议替换成反代所使用的二级域名比如tt.jude.me
@imzhi
imzhi / client.php
Created July 31, 2015 03:48
PHP Soap
<?php
$c = new SoapClient(null, array('uri' => 'http://localhost/tests/php_practice', 'location' => 'http://localhost/tests/php_practice/server.php', 'trace' => true));
$h = new SoapHeader('http://localhost/tests/php_practice', 'auth', '123456', false, SOAP_ACTOR_NEXT);
$c->__setSoapHeaders($h);
try {
echo $c->say();
} catch (Exception $e) {
echo $e->getMessage();