Skip to content

Instantly share code, notes, and snippets.

View kebot's full-sized avatar
🏠
Working from home

Keith Yao kebot

🏠
Working from home
View GitHub Profile
jQuery.fn.letsFixed = function(options){
// make default settings
var settings = {}
return this.each(
function(){
// let them fixed
var t=$(this);
var width=t.css('width');
var height = t.css('height');
var offset = t.offset();
var bingCW_ht_pop_el = document.getElementById("bingCW_ht_pop");
if (bingCW_ht_pop_el == null)
BingCW = new function() {
this.Config = {Disabled: false,DisableHover: false,DisableSelection: false,DisablePharse: false,WebDefinition: true,MachineTranslation: true,ICON: "ZH"};
var I = "D1CB4BBF472140DE99370A52F1F8F554", o = [document.body], F = {}, n = null, a = null, m = [], l = [], v = null, q = [], h = null, E = false, p = "dict.bing.com.cn", ab = "#bingCW_ht_pop,#bingCW_ht_box,#bingCW_ht_content,#bingCW_ht_QWA,#bingCW_ht_footer,.bingCW_ht_QueryWord,.bingCW_ht_attr,.bingCW_ht_pos,.bingCW_ht_list,.bingCW_ht_list2,.bingCW_ht_listItem,.bingCW_ht_listItem2,.bingCW_ht_link,#bingCW_ht_badge{margin:0px;padding:0px;width:auto;height:auto;white-space:normal;border:0px solid #ace;background-color:White;background-image:none;text-indent:0px;line-height:17px;font-family:arial, helvetica, sans-serif;font-size:13px;color:Black;float:none;visibility:visible;text-align:left;vertical-align:baseline;display
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import session, g, Flask, request, abort
app = Flask(__name__)
urls = (
'/song/<int:sid>', 'Song',
)
@kebot
kebot / Makefile
Last active December 11, 2015 05:58
Make file for rsync, it's a simple dropbox
#
# Makefile for rsync
#
# [help with rsync](http://bbs.chinaunix.net/thread-2116588-1-1.html)
RSYNC_SERVER = <username>@<server>:~/Cloud
-- Author: Michael Bianco <http://mabblog.com/>
-- Some help from: http://discussions.info.apple.com/message.jspa?messageID=10363317
on create_vpn_service(vpn_name)
tell application "System Preferences"
reveal pane "com.apple.preference.network"
activate
tell application "System Events"
tell process "System Preferences"
# first we build a 20 * 20 table
# each table contains a char value that can be '*' or '-'
table = [['-' for i in range(0, 20)] for i in range(0, 20)]
def print_table(table):
""" then we define a function that can print the table into screen"""
for row in table:
print " ".join(row)
int stepSize = 5;
int r = -45;
draw() {
rotate(radians(r));
r += stepSize;
@kebot
kebot / webpack.config.js
Last active February 18, 2016 08:33
Mix normal css and css-module in webpack
module.exports = {
// ...
module: {
loaders: [{
test: /\.module\.(scss|css)$/,
loaders: [
'style-loader', 'css-loader?module', 'autoprefixer-loader',
'sass-loader'
]
}, {
@kebot
kebot / lodash-v3-import-to-v4.js
Created May 21, 2016 16:56
codemod that upgrade lodash v3 import to v4
// this codemod will replace all 'lodash/<whatever>/<func>' -> 'lodash/<func>'
// usage: jscodeshift -t tools/lodash-3-4.js src
let transformModuleName = (name) => {
let matchObj = name.match(/^lodash\/(.*)\/(.*)/)
if(matchObj) {
return ['lodash', matchObj[2]].join('/')
}
return name
}
@kebot
kebot / TTPlayer(LRC).py
Created June 3, 2016 09:49 — forked from douo/TTPlayer(LRC).py
Lyrics Grabber2 的千千静听歌词抓取脚本
# -*- coding: utf-8 -*-
import encodings.utf_8
import math
import urllib, urllib2
import random
import re
from xml.dom import minidom
from LevenshteinDistance import LevenshteinDistance
from grabber import LyricProviderBase