Skip to content

Instantly share code, notes, and snippets.

liunian

Block or report user

Report or block liunian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@liunian
liunian / Phoenix theme.json
Last active Aug 15, 2018
SublimtText settings
View Phoenix theme.json
{
"caret_extra_bottom": 3,
"caret_extra_toop": 3,
"caret_extra_width": 3,
"color_scheme": "Packages/Theme - Phoenix/Color Scheme/Phoenix Dark Orange.tmTheme",
"font_size": 15,
"highlight_liine": true,
"ignored_packages":
[
"Theme - Cobalt2",
@liunian
liunian / random_modify.py
Created Aug 13, 2018
modify large randomly
View random_modify.py
#!/usr/bin/env python
import os
import sys
import mmap
import string
import random
from pathlib import Path
def random_str(len):
@liunian
liunian / delSvn.py
Created Jun 23, 2018
remove .svn directory
View delSvn.py
#!/usr/bin/env python3
import os
import shutil
path = input('enter dir path: ')
del_list = []
for p, d, f in os.walk(path):
if '.svn' in d:
del_path = os.path.join(os.path.abspath(p), '.svn/')
View Wallpapers.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import bs4
import re
import os
import sys
from multiprocessing import Pool, cpu_count
try:
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="UAT FLOW">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
</head>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
</head>
<body>
View clone-json.js
// from: https://jsperf.com/deep-copy-vs-json-stringify-json-parse/15
function recursiveDeepCopy(o) {
var newO,
i;
if (typeof o !== 'object') {
return o;
}
if (!o) {
@liunian
liunian / to_ascii.js
Last active Jun 28, 2017
把超出 ascii 范围的字符(如中文)等转为基于 ascii 范围字符的转义表达形式(https://github.com/mishoo/UglifyJS2/blob/master/lib/output.js#L76
View to_ascii.js
// from https://github.com/mishoo/UglifyJS2/blob/harmony/lib/output.js
function to_ascii(str) {
return str.replace(/[\ud800-\udbff][\udc00-\udfff]|[\u0000-\u001f\u007f-\uffff]/g, function (ch) {
var code = get_full_char_code(ch, 0).toString(16);
if (code.length <= 2) {
while (code.length < 2) code = "0" + code;
return "\\x" + code;
} else {
while (code.length < 4) code = "0" + code;
View parseDate.js
/**
* 把 2014-02-02 15:30:20 转换为 Date 对象,
* iOS Safari 仅支持 1995-12-17T03:24:00 格式,故对更常用的无 T 的需额外处理
*
* @param {String} dateString - 待转换的时间字符串,格式形如 2014-02-02 15:30:20
*
* @return {Date} - 转换后的 Date 对象
*/
function parseDate(dateString) {
var arr = dateString.split(/[- :]/);
View unicode_with_js.js
{
decodeSpecialUnicode: function(str) {
var ptn = /\\u([0-f]{4})/ig;
return str.replace(ptn, function(match, group) {
return String.fromCharCode(parseInt(group, 16));
});
},
encodeSpecialUnicode: function(str) {
You can’t perform that action at this time.