Skip to content

Instantly share code, notes, and snippets.

@wjch
wjch / titleUrlMarkdownClip.js
Created July 27, 2020 01:35 — forked from alexeagle/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@wjch
wjch / ExportWordUtils.java
Created July 24, 2020 03:11
导出word的工具类
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.jeecgframework.poi.word.WordExportUtil;
import org.jeecgframework.poi.word.entity.MyXWPFDocument;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
@wjch
wjch / wordpress_sina_image_replace.py
Created May 20, 2019 09:54
将wordpress文章中的新浪图片下载到本地,并替换
#-*- coding=utf-8 -*-
"""
作者:Abbey
博客:www.abbeyok.com
脚本简介:脚本通过查找wordpress文章中的新浪图床图片,自动下载到本地目录,并替换文章中的链接。
脚本使用说明:
1. 安装好Python2.7。如果是linux系统,应该可以免去该步骤
2. 安装依赖包:
@wjch
wjch / MainActivity.java
Created March 20, 2017 01:48 — forked from nickbutcher/MainActivity.java
A quick sample of the new physics-based animation library added in Support Library 25.3.0 docs: https://developer.android.com/reference/android/support/animation/package-summary.html output: https://twitter.com/crafty/status/842055117323026432
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wjch
wjch / ToStringConverterFactory.java
Created January 22, 2017 10:04
Retrofit方法,将数据转换成String类型的数据
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.ResponseBody;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import retrofit.Converter;
@wjch
wjch / bezier.js
Created July 25, 2016 16:19 — forked from LiuJi-Jim/bezier.js
De Casteljau Bezier
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],
@wjch
wjch / DividerItemDecoration.java
Created June 20, 2016 09:45 — forked from zokipirlo/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@wjch
wjch / bilibili.zsh
Created May 24, 2016 11:52 — forked from quxiaowei/bilibili.zsh
从哔哩哔哩下载剧,并将视屏片段合并 需要:youtube-dl, ffmpeg
for i in {1..12}
do
url=http://www.bilibili.com/video/av3794937/index_$i.html
echo $url
youtube-dl -o "SeGmEnT-$i-%(playlist_index)s.%(ext)s" $url
rm -f buffer_list
touch buffer_list
for file in $(ls SeGmEnT-$i-*.flv)
do
echo file "'$file'" >> buffer_list
@wjch
wjch / Personal Blocklist
Created January 7, 2016 02:21
Personal Blocklist
001nlp.com
111cn.net
151.com.tw
15meili.com
258369.cn
28im.com
360doc.com
3v4.net
4byte.cn
51edu.com
/**
* 开启一个子线程来运行服务,来处理异步的任务请求
* An {@link IntentService} subclass for handling asynchronous task requests in
* a service on a separate handler thread.
* <p/>
*/
public class TestIntentService extends IntentService {
// TODO: Rename actions, choose action names that describe tasks that this
// IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS
private static final String ACTION_DOWNLOAD = "com.mywjch.learnrxjava.action.FOO";