This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const year = '2019'; | |
Array.from(document.querySelectorAll('.wallet_table_row')) | |
.filter(tr => { | |
return ( | |
tr.querySelector('.wht_type div:first-child').textContent === '购买' && | |
tr.querySelector('.wht_date').textContent.indexOf(year) !== -1 | |
); | |
}) | |
.map(tr => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"basics": { | |
"name": "Cheng Liu", | |
"label": "Web Developer", | |
"summary": "A Web Developer who love building websites and webapps", | |
"email": "[email protected]", | |
"location": { | |
"city": "Shanghai", | |
"countryCode": "CN" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import optparse | |
from watchdog.observers import Observer | |
from watchdog.events import FileSystemEventHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ai_dir=/opt/www/ai | |
function scandir() { | |
local cur_dir workdir | |
workdir=$1 | |
cd ${workdir} | |
if [ ${workdir} = "/" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hex2bin($data) | |
{ | |
return pack("H" . strlen($data), $data); | |
} | |
function encrypt($key, $data) | |
{ | |
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128,MCRYPT_MODE_ECB),MCRYPT_RAND); | |
return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_ECB, $iv)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.event_map = function(map){ | |
var el = this; | |
$.each(map, function(k, v){ | |
var event = k.slice(0, k.indexOf(" ")), | |
selector = k.slice(k.indexOf(" ") + 1, k.length); | |
if(event && typeof v === "function"){ | |
if(k.indexOf(" ") != -1){ | |
el.on(event, selector, v); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
from bottle import Bottle, debug, get, static_file, run | |
@get("/<filetype>/<filename:path>") | |
def static(filetype,filename): | |
merged_file = "./cache/" + filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter = function(_html) { | |
var qualifyURL = function(html) { | |
html = html.replace(/href=\"([^\"]*)\"|href=\'([^\']*)\'/ig, function(url) { | |
if(url == "" || url.search(/javascript:|vbscript:/) != -1){ | |
return ""; | |
} | |
try { | |
return 'href="' + qualify(url.split('href="')[1].split('"')[0]) + '"'; | |
} catch (e) { | |
return 'href="' + qualify(url.split("href='")[1].split("'")[0]) + '"'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replaceImgSrc(id){ | |
var imgs = document.getElementById(id).getElementsByTagName("img"); | |
for(var i=0;i<img.length;i++){ | |
imgs[i].src = qualifyURL(imgs[i].src); | |
} | |
} | |
function qualifyURL(url){ | |
var img = document.createElement('img'); | |
img.src = url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div{ | |
display:none; | |
} | |
div[id],div[class]{ | |
display:block; | |
} |