Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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;