Skip to content

Instantly share code, notes, and snippets.

View 599316527's full-sized avatar

Kyle He 599316527

View GitHub Profile
@599316527
599316527 / remove-google-search-results-redirect.js
Last active August 29, 2015 14:26
Injected JS for removing redirect
(function (a) {
if (!a) return ;
var r = a.getAttribute('onmousedown').match(/^return (\w+)\(/i);
if (r && r[1]) {
window[r[1]] = function () {};
}
})(document.querySelector('#rso h3.r a'));
@599316527
599316527 / jasmine.js
Last active November 17, 2015 08:39
Customizing Jasmine Global Json Diff Matchers
/**
* @file customizing jasmine global json diff matchers
* @author Kyle He (4hekai@gmail.com)
*/
var path = require('path');
var jsonDiffPatch = require('jsondiffpatch');
var Jasmine = require('jasmine');
var jasmine = new Jasmine({
@599316527
599316527 / animation.js
Created January 27, 2016 04:35
jd snow animation
function randomRange(t, i) {
return Math.random() * (i - t) + t
}
Particle3D = function(t) {
THREE.Particle.call(this, t), this.velocity = new THREE.Vector3(0, -2, 0), this.velocity.rotateX(randomRange(-45, 45)), this.velocity.rotateY(randomRange(0, 360)), this.gravity = new THREE.Vector3(0, 0, 0), this.drag = 1
}, Particle3D.prototype = new THREE.Particle, Particle3D.prototype.constructor = Particle3D, Particle3D.prototype.updatePhysics = function() {
this.velocity.multiplyScalar(this.drag), this.velocity.addSelf(this.gravity), this.position.addSelf(this.velocity)
};
var TO_RADIANS = Math.PI / 180;
@599316527
599316527 / Pagination.vue
Last active May 11, 2016 13:12
Vue.js Pagination Component
<template>
<nav>
<ul class="pagination" @click="handleClick($event)">
<li v-if="no > 1">
<a :href="hrefPrefix + (no - 1)" :data-page="no - 1">&lt;</a>
</li>
<li v-for="i in pageIndicatorSeries" :class="{active: i === no}">
<a :href="hrefPrefix + i" :data-page="i">{{ i }}</a>
</li>
<li v-if="no < pageCount">
@599316527
599316527 / dnspod-ddns.js
Created July 26, 2016 13:12
DnsPod 动态DNS 脚本
/**
* @file ddns script for dnspod
* @author Kyle He
*/
const exec = require('child_process').exec;
const FormData = require('form-data');
const fetch = require('node-fetch');
(new Promise(function (resolve, reject) {
@599316527
599316527 / zimuzu-sign.sh
Last active November 19, 2016 07:53
zimuzu.tv 签到脚本
#!/bin/sh
ACCOUNT="xijinpin@gov.cn"
PASSWORD="fuckccp!"
#########################################
function urlEncode() {
python -c "
import urllib, commands, os;
@599316527
599316527 / waterfall-layout.js
Last active May 4, 2017 09:18
Waterfall Layout Calculation
import {merge} from 'lodash'
const defaultContainerPadding = {
top: 0,
bottom: 0,
left: 0,
right: 0
}
/**
* 在 m.weibo.cn 的 console 里跑
*/
let startPageNo = 1
let pageLength = 90
let delInterval = 1543
let options = {
@599316527
599316527 / batch-remove-apple-apps.sh
Created November 24, 2017 04:37
批量删除苹果内置Apps
sudo rm -rf "/Applications/Calendar.app";
sudo rm -rf "/Applications/Chess.app";
sudo rm -rf "/Applications/Contacts.app";
sudo rm -rf "/Applications/DVD Player.app";
sudo rm -rf "/Applications/FaceTime.app";
sudo rm -rf "/Applications/Mail.app";
sudo rm -rf "/Applications/Maps.app";
sudo rm -rf "/Applications/Notes.app";
sudo rm -rf "/Applications/Photo Booth.app";
sudo rm -rf "/Applications/Photos.app";
@599316527
599316527 / demo.html
Last active April 11, 2018 13:54
iOS 11.3 Safari bug: animation runs again when back-forward https://twitter.com/kyleehee/status/984059601539616768
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<style type="text/css">
div {
width: 100px;
height: 100px;