Skip to content

Instantly share code, notes, and snippets.

View neilwong2012's full-sized avatar
👐
Touching the fish

neil wong neilwong2012

👐
Touching the fish
View GitHub Profile
@neilwong2012
neilwong2012 / vimrc.local
Last active August 29, 2015 14:21
vimrc config
set shiftwidth=2
set tabstop=2
set softtabstop=2
let NERDTreeQuitOnOpen=0
" 优化缩进提示显示
if !has('gui_running')
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=black ctermbg=0
@neilwong2012
neilwong2012 / js
Created December 9, 2015 05:56
function.js
//汉字截取字符串
function cutstr(str, len) {
var str_length = 0;
var str_len = 0;
str_cut = new String();
str_len = str.length;
for (var i = 0; i < str_len; i++) {
a = str.charAt(i);
str_length++;
@neilwong2012
neilwong2012 / sh
Last active September 29, 2016 10:45
file recover
一个终端(记为A):
# [07/06 19:16:15] xenon@ribosome ~ $
touch delete-me
# [07/06 19:16:22] xenon@ribosome ~ $
vim delete-me
写进去一行字,作为内容。
另一个终端(记为B)打开文件:
@neilwong2012
neilwong2012 / html
Created January 7, 2016 10:51
ios不拨打电话号码
<meta name="format-detection" content="telephone=no" />
@neilwong2012
neilwong2012 / conf.json
Created February 25, 2016 04:02
shadowsocks 配置脚本
{
"server_port":3000,
"password":"[password]",
"timeout":60,
"method": "rc4-md5"
}
@neilwong2012
neilwong2012 / status_code.md
Created April 29, 2016 02:15
响应码说明

100 Continue 初始的请求已经接受,客户应当继续发送请求的其余部分。(HTTP 1.1新)

101 Switching Protocols 服务器将遵从客户的请求转换到另外一种协议(HTTP 1.1新)

200 OK 一切正常,对GET和POST请求的应答文档跟在后面。

201 Created 服务器已经创建了文档,Location头给出了它的URL。

202 Accepted 已经接受请求,但处理尚未完成。

@neilwong2012
neilwong2012 / redeem.php
Created August 18, 2016 02:22
兑换码生成
/*
* params $typeId 批次id
* params $id id
* return $code
*/
function initCode($typeId, $id) {
$arr = array('n', 'w', 't', 'b', 's', '9', '8', 'g', '6', 'd', 'k', 'm', '2', '5', 'p', 'q', 'y', 'r', 'u', 'e', '4', '7', 'c', 'j', 'z', 'f', 'h', 'y', 'a', '3', 'x');
$length = count($arr);
$codeArr = array();
@neilwong2012
neilwong2012 / analysis.php
Last active February 6, 2017 06:38
日志分析脚本
<?php
$file = fopen('a.log', 'r');
$i = 0;
$mysqli = new mysqli("ip", "username", "password", "database");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
while(! feof($file)) {
@neilwong2012
neilwong2012 / steam.js
Created April 17, 2018 13:51
steam 优化评分展示脚本
const hideEle = (item) => {
let parentNode = item.parentNode;
let maxLoop = 15;
while(parentNode.tagName !== 'A' && maxLoop > 0) {
parentNode = parentNode.parentNode;
maxLoop--;
}
item.dataset.isCheck = '1'
parentNode.style.display = 'none';
@neilwong2012
neilwong2012 / steam2.js
Last active April 18, 2018 03:13
steam评分优化脚本
const hideEle = (item) => {
let parentNode = item.parentNode;
let maxLoop = 15;
while(parentNode.tagName !== 'A' && maxLoop > 0) {
parentNode = parentNode.parentNode;
maxLoop--;
}
item.dataset.isCheck = '1'
parentNode.style.display = 'none';
}