This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 统计埋点代码 | |
* @author 丘迟 <[email protected]> | |
*/ | |
(function(S, win, doc, undefined) { | |
var E = S.Event; | |
//默认的前缀 | |
//可以通过在后面的脚本修改全局变量来动态修改 | |
win.STAT_PREFIX = 'http://www.atpanel.com/search?'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
real_git=$(which git) | |
git () { | |
curr_branch=$($real_git branch | sed -n 's/\* //p') | |
if [[ ($curr_branch != master && $1 == 'svn' && $2 == 'dcommit') ]] | |
then | |
if [[ $($real_git svn info | grep trunk) ]]; then | |
echo "You are in svn trunk, but not on git master." | |
echo "Exit." | |
echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [{ | |
text: '我们都是好孩子', | |
pinyin: 'wo men dou shi hao hai zi'.split(' ') | |
}, { | |
text: '我没有病', | |
pinyin: 'wo mei you bing'.split(' ') | |
}, { | |
text: '我们都好', | |
pinyin: 'wo men dou hao'.split(' ') | |
}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ANIMATION_END = "webkitAnimationEnd mozAnimationEnd | |
MSAnimationEnd oanimationend | |
animationend" | |
$.fn.anim = (cls, options, nextDelay) -> | |
@removeClass("animated #{@data('_last_anim')}") | |
@data '_last_anim', cls | |
if 'number' is typeof options | |
options = { duration: "#{options/1000}s" } | |
if options? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BatchStream = require('batch-stream2') | |
var gulp = require('gulp') | |
var coffee = require('gulp-coffee') | |
var uglify = require('gulp-uglify') | |
var cssmin = require('gulp-minify-css') | |
var bower = require('gulp-bower-files') | |
var stylus = require('gulp-stylus') | |
var livereload = require('gulp-livereload') | |
var include = require('gulp-include') | |
var concat = require('gulp-concat') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.blength = function() { | |
return this.replace(/\n\r/g, '\n').replace(/[^\x00-\xff]/g, 'xx').length; | |
}; | |
function btrunc(text, limit) { | |
limit = Number(limit) || 10 | |
if (text.blength() < limit * 2) { | |
return text | |
} | |
var ret = '', count = 0, i = 0, max = limit * 2 - 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TT_TEMPLATES = | |
suggestion: (d) -> | |
"<p>#{d.name} <small class=\"district\">#{d.district}</small></p>" | |
map = new AMap.Map elem, level: 4 | |
map.plugin ['AMap.Autocomplete'], => | |
bb = new Bloodhound | |
datumTokenizer: (d) -> [d.name, d.district] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(zipcode) | |
library(magrittr) | |
library(dplyr) | |
library(stringr) | |
library(acs) | |
# load all zipcodes | |
data(zipcode) | |
kAPIKey <- "YOUR API KEY" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stringdist) | |
library(stringr) | |
library(dplyr) | |
library(readr) | |
kSourceDir <- "~/Downloads/assignments" | |
ReadFiles <- function(path) { | |
files <- list.files(path) | |
ret <- str_c(path, "/", files) %>% |