Skip to content

Instantly share code, notes, and snippets.

@leplay
leplay / stash-ip.js
Created December 16, 2023 08:25
stash-ip.js
$httpClient.get('https://api.my-ip.io/ip', function (error, response, data) {
$done({
title: '当前 IP 地址',
content: data,
backgroundColor: '#663399',
icon: 'network',
})
})
@leplay
leplay / accounts-assets.bean
Last active October 12, 2023 05:16
Beancount + Costflow
2019-01-01 open Assets:CN:Cash
2019-01-01 open Assets:CN:Alipay ; 支付宝余额
2019-01-01 open Assets:CN:Wechat ; 微信零钱
2019-01-01 open Assets:CN:DebitCard:CMB ; 招商银行储蓄卡
2019-01-01 open Assets:CN:DebitCard:BOC ; 中国银行储蓄卡
2019-01-01 open Assets:CN:FinTech:LCT ; 微信理财通
2019-01-01 open Assets:CN:FinTech:ZZY ; 招行朝朝盈
2019-01-01 open Assets:CN:FinTech:YEB ; 支付宝余额宝
@leplay
leplay / detect-emoji-support.js
Last active March 20, 2019 13:43
Detects support for emoji character sets.
// https://stackoverflow.com/questions/45576748/how-can-i-detect-rendering-support-for-emoji-in-javascript
// https://raw.githubusercontent.com/Modernizr/Modernizr/master/feature-detects/emoji.js
// function check (emoji) {
// var pixelRatio = window.devicePixelRatio || 1;
// var offset = 12 * pixelRatio;
// var node = document.createElement('canvas');
// var ctx = node.getContext('2d');
// ctx.fillStyle = '#f00';
@leplay
leplay / random.js
Last active January 8, 2019 04:13
Random String in JavaScript
// https://stackoverflow.com/a/1349426
let r = Math.random().toString(36).substr(2, 5)
console.log("random", r)
@leplay
leplay / wget-site.sh
Created December 3, 2017 03:58
Download an entire static website to your local machine
wget --recursive --page-requisites --convert-links www.example.com

Keybase proof

I hereby claim:

  • I am leplay on github.
  • I am leplay (https://keybase.io/leplay) on keybase.
  • I have a public key ASAouxNbMoFotWftmRVY0XXsSLCOuER3NLYJlKG0CgHVlwo

To claim this, I am signing this object:

#!/bin/bash
sudo apt-get update
sudo apt-get install -y htop
sudo apt-get install -y nginx
sudo apt-get install -y git
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
$('._jjzlb img').each(function() {
var img = $(this).attr('src')
var arr = img.split('/')
var link = $('<a>',{
href: img,
download: arr[arr.length - 1]
});
link[0].click()
});
@leplay
leplay / marquee.js
Last active November 20, 2016 14:58
Github contribution marquee effect
// open someone's github page, and run this script in your console
var eles = $$('svg > g > g');
var shift = 0;
var marquee = setInterval(function() {
shift++;
for(var i = 0; i < eles.length; i++) {
var rectShift = 13 - i;
// http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));