Skip to content

Instantly share code, notes, and snippets.

@zythum
zythum / React inherit
Created May 27, 2015 09:16
React inherit
var Extend = (function (prototype, apply) {
function assert(condition, message) {
if (!condition) {
message = message || "Assertion failed"
if (typeof Error !== "undefined") throw new Error(message);
throw message
}
}
define("video.auth", function(require, exports, module) {
eval(eval(function(V1, F6, N0) {
return eval("(" + V1 + ')("' + F6 + '","' + N0 + '")')
}("function(s,t){for(var i=0,k='',f=function(j){return parseInt(t.substr(j%(t.length),2),16)/2;};i<s.length;i+=2){var d=parseInt(s.substr(i,2),16);k+=String.fromCharCode(d-f(i));}return k;}", "ded5df8c9c90d3a29cdca3d1d2e1d1e3db945edae2c6e6969594ac9598eca09f618fe4989db45edba4a5a79c8fb2578b9f9ba2ad60a8a196a2a4e5a06a9b9487ee985a93e7a3989dac946a969a9eb9a85a93e79eccdaa4cd6dc1a09cd6ae5f8ca995a0ad9ba27a919895ecd9579faca496a49ea57a91ab8da5ac5c93a8b29aa09ea56393b1989db05697a49b99a7b29f61909f939da2809bac95cee9dbcfa9c8dbd39cbe5e8fb8a491efe3cda77fc497b198508fb79ea5a4e59e989da595a2aa7394ae9598eca29e618fe49aa89f688ba6a596adb29d618fe49ba59f6c8ba1a096a5b29f61989f93a8ab67a89a9e91b3959cad949f91a4ee60c898a790aa9e986a939a8eb29e66949da4ad9f9e986e8f9a9aaabb608cae959fac9b9f6aa49797a098768598a79096a09c6681989dad9f6c9ba69b9eab9fb1659ed2c6e0e9939d9fe599a8a99465d7a095a0a863919
'javascript'
function sum (params) {
return [].reduce.call(arguments, function(r, v){return r + v})
}
sun(1,2,3,4,5,6)
'coffeescript'
#用一个checkbox来做开关
flag = true;
$('input[type=checkbox]').on 'click', ()->
flag = $(this).prop 'checked'
#return
#这个return 必须加,不如就呵呵了
#这个不算是问题,是需要注意的点
#i用户统计点击了多少次页面, 产经理最喜欢统计数据了
i = 0;
document.body.addEventListener 'click', ()-> console.log ++i
# 很简单的数值交换函数 o.prop1 <=> o.prop2
_switch = (o, prop1, prop2)->
#`var i`
i = o[prop2]
o[prop2] = o[prop1]
function where_is_my_func () {
return 'I am here'
}
function sun (a, b) {
var where_is_my_func = 'your are not here'
b = [].slice.call(arguments, 1)
return !b.length ? a : arguments.callee.apply(this, [b, b[0] += a][0])
}
sun(1, 2, 3, 4, 5, 6, 7, 8, 9)
sun = (a, b...)->
where_is_my_func = 'your are not here'
unless b.length then a else b[0] += a; arguments.callee.apply @, b
where_is_my_func = -> 'I am here'
sun 1,2,3,4,5,6,7,8,9
console.log where_is_my_func
###################################
@zythum
zythum / gist:2856612
Created June 2, 2012 04:35
检测google敏感词
var b=_.L.NF().getKey(), c= _.L.NF().eH(), f=[];
for(var g=0,l=c.length,t=[],i; i=c[g],g<l; f.push(t.join('')),g++)
for(t=[],p=0;p<i.length;++p)
t.push(window.String.fromCharCode(i[p]^b));
console.log(f.join('\n')+'\n总数:'+f.length+'个');
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词