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
地址在 http://showterm.io/7881a7c028d436b077273 | |
脚本如下: | |
# statlysis是一个数据引擎分析框架,核心是对ETL之后的单表数据做类似SQL中GroupBy和GroupConcat的工作, | |
# 就像操作ActiveRecord等ORM一样简单。项目地址在 http://github.com/mvj3/statlysis | |
# 在这个test/helper.rb被载入后我们已经导入数据和建立Model了, | |
# 所以下面我们就来开始试用statlysis吧。 |
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
$(document).ready(function() { | |
var dom = $("<div>").attr('id', 'mvj3'); | |
$("body").html(dom); | |
window.mvj3 = Backbone.View.extend({ | |
initialize: function(opts) { | |
this.opts = opts; | |
return this; | |
}, | |
tagName: "div", | |
render: function() { |
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
(function () { | |
"use strict"; | |
var copyOwnProperties = function (from, to) { | |
for (var propertyName in from) { | |
if (from.hasOwnProperty(propertyName)) { | |
to[propertyName] = from[propertyName]; | |
} | |
} | |
}; |
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
def computer(): | |
count = 5 | |
def plus(num): | |
count += num | |
print count | |
return plus | |
plus = computer() | |
plus(3) | |
plus(5) | |
""" |
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
*gz | |
*.txt |
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
from singleton import singleton | |
@singleton(True) | |
class hh(object): | |
cc = 0 | |
def __init__(self): | |
hh.cc += 1 | |
self.count = hh.cc |
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
_.each(Array(10), -> Array(Math.pow(10, 8)).join("=").length) |
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
# Lazy reference between tasks, include recursive references. | |
# 1. `eval` version | |
def ref_tasks(*tasks): | |
def wrap(task1): | |
def _ref_task(self): | |
return eval(task1) | |
return _ref_task |
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
`hg log --template 'date: {date|isodate}\n' | grep 'date: '`.split("\n").map {|i1| i1[6..15] }.inject({}) {|d1, i1| d1[i1] ||= 0; d1[i1] += 1; d1 }.sort {|a, b| a[0] <=> b[0] }.each {|i| puts i.inspect };0 | |
__END__ | |
["2014-09-24", 4] | |
["2014-09-25", 8] | |
["2014-09-26", 6] | |
["2014-09-28", 10] | |
["2014-09-29", 14] | |
["2014-09-30", 3] | |
["2014-10-08", 14] |
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
# -*- coding: utf-8 -*- | |
""" | |
Overwrite base class's methods. | |
""" | |
import unittest | |
class Base(object): |