Skip to content

Instantly share code, notes, and snippets.

View ty-cs's full-sized avatar
🎯
Focusing

Tianyu Li ty-cs

🎯
Focusing
  • Earth
View GitHub Profile
'use strict';
let coupon_timer = null;
let cnt = 0;
(function () {
// get the coupon element
let coupon = document.querySelectorAll('p[data-coupon-activity]');
// get the close btn
let close = document.querySelectorAll('body > div.coupon_dialog_jf > div.header > div');
// click the coupon
@ty-cs
ty-cs / getAutumnCourses.js
Last active August 16, 2017 19:01
have a look at Autumn courses ahead of time...
(() => {
const iframe = document.createElement('iframe');
iframe.style.display = "none";
iframe.id = "hit";
iframe.src = 'https://vpn.hit.edu.cn/,DanaInfo=jwts.hit.edu.cn/kbcx/queryGrkb';
document.body.appendChild(iframe);
const subWindow = document.getElementById('hit').contentWindow;
@ty-cs
ty-cs / quicksort.js
Last active December 13, 2017 18:08
Quick Sort with ES6
function quickSort(arr){
if(!arr.length) return [];
const [pivot, ...rest] = arr;
return [...quickSort(rest.filter(x=>x<pivot)),pivot,...quickSort(rest.filter(x=>x>=pivot)),];
}
@ty-cs
ty-cs / bitCount.js
Created November 17, 2017 12:42 — forked from mscdex/bitCount.js
Fastest bit counting for 32-bit numbers in javascript
function bitCount(u) {
// https://blogs.msdn.microsoft.com/jeuge/2005/06/08/bit-fiddling-3/
const uCount = u - ((u >> 1) & 0o33333333333) - ((u >> 2) & 0o11111111111);
return ((uCount + (uCount >> 3)) & 0o30707070707) % 63;
}
@ty-cs
ty-cs / GitCommitEmoji.md
Created December 1, 2017 14:10 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@ty-cs
ty-cs / npm.taobao.sh
Created June 14, 2018 08:46 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
@ty-cs
ty-cs / nginx.conf
Created June 30, 2018 12:47 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
console.log('start');
setTimeout(()=>console.log(233),1000);
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)