Skip to content

Instantly share code, notes, and snippets.

View amio's full-sized avatar
:octocat:

Amio Jin amio

:octocat:
View GitHub Profile
@amio
amio / esnextbin.md
Last active August 19, 2016 10:12
esnextbin sketch
@amio
amio / elegant-dev-sites.md
Last active August 19, 2016 04:00
Beautiful Web for Developers
@amio
amio / error-schema.json
Created July 9, 2016 10:57
General Browser Error Schema
{
"title": "General Browser Error Schema",
"type": "object",
"properties": {
"source": {
"type": "string"
},
"message": {
"type": "string"
},
@amio
amio / youtube-screenshot.user.js
Last active July 9, 2016 13:24
Youtube Screenshot Button
// ==UserScript==
// @name Youtube Screenshot Button
// @description Adds a button that lets you take screenshot.
// @homepageURL https://gist.github.com/amio/785a9eba8e58af1ddba7623613cfbc10
// @author Amio
// @version 1.0.0
// @date 2016-07-09
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// @exclude http://www.youtube.com/embed/*
@amio
amio / throttled-raf.js
Created June 29, 2016 10:45
Throttled requestAnimationFrame
// Usage:
//
// var onScroll = traf(function () {
// item[0].style.width = window.scrollY + 100 + 'px';
// })
// window.addEventListener('scroll', onScroll, false);
export default function traf (fn) {
var ticking = false;
@amio
amio / emoji-json.userscript.js
Last active June 22, 2016 10:49
Generator for emoji.json
// Generate emoji.json from
// http://unicode.org/emoji/charts/full-emoji-list.html
{
const ids = $$('td.rchars')
const trs = ids.map(e => e.parentElement)
const db = trs.map(tr => {
const tds = tr.getElementsByTagName('td')
return {
no: tds[0].innerText,
@amio
amio / userscript.js
Created June 5, 2016 16:10
Sina 微博 - 取关所有
$('a[action-type=batselect]').click()
$$('.member_wrap').map(x => x.click())
$('a[action-type=cancel_follow_all]').click()
$('a[action-type=ok]').click()
@amio
amio / rm-ite.sh
Last active March 14, 2020 13:52
Remove ''www.it-ebooks.info" from pdf.
#!/bin/bash
source_dir=$1;
find "$1" -type f -name "*.pdf" -print0|while read -d $'\0' file;
do
if [ `strings "$file"|grep -c "www.it-ebooks.info"` -gt 0 ];
then
echo "$file";
cp "$file" /tmp/1.pdf;
script=$(cat <<'EOF'
use strict;
@amio
amio / syncify.js
Created February 9, 2016 07:59
syncify.js
// 1. fn's last argument should be a callback
// 2. the syncified function returns an array, which is the arguments for that callback.
function syncify (fn) {
let doing = true
return function (...args) {
let result = undefined
fn(...args, (...callbackArgs) => {
result = callbackArgs
doing = false
})