Skip to content

Instantly share code, notes, and snippets.

View rikan's full-sized avatar
🎯
Focusing

qian.li rikan

🎯
Focusing
  • china, shanghai
View GitHub Profile
@rikan
rikan / javascript 继承方式之一
Created August 13, 2014 05:49
来自typescript
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
//__.constructor = __.prototype.constructor
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
//Note:类似于下面方式和属性拷贝的综合
function extend(Child, Parent) {
@rikan
rikan / 有$.Deferred
Created August 12, 2014 08:30
$.Callbacks实现订阅模式
(function(){
var topics = {};
jQuery.Topic = function(id){
var callback = $.Callbacks();
var topic = id && topics[id];
if(!topic){
topic = {
publish: callback.fire,
subscribe: callback.add,
unsubscribe: callback.remove
@rikan
rikan / 禁止web上选择高亮
Created August 12, 2014 02:31
禁止web上选择高亮
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting
@rikan
rikan / 记录bat执行次数到log file
Last active August 29, 2015 14:03
记录bat执行次数到log file
@echo off
REM log the run times of this bat script to the log.txt
set "directory=%~dp0"
set "log_file=%directory%log.txt"
if not exist %log_file% (
copy NUL %log_file%
echo 1 >> %log_file%
goto COUNT_END
) else (