View report.py
This file contains 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 -*- | |
import random | |
import json | |
import js | |
class RandomData(): | |
def __init__(self, rows=5, dimensions=1, metrics=2): | |
self.data = [] |
View demo.py
This file contains 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 -*- | |
todo = [ | |
{"a": 1, "b": 1}, | |
{"a": 2, "b": 2}, | |
{"a": 1, "b": 1}, | |
{"a": 0, "b": 1}, | |
{"a": 2, "b": 2}, | |
{"a": 0, "b": 2}, | |
{"a": 2, "b": 2}, |
View deriv-middle-parentheses.scm
This file contains 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
(define (=number? a v) (and (number? a) (= a v))) | |
(define (variable? e) (symbol? e)) | |
(define (sum? e) | |
(and (pair? e) (eq? (cadr e) '+))) | |
(define (sum-a e) (car e)) | |
(define (sum-b e) | |
(if (= (length e) 3) (caddr e) (cdr (cdr e)))) | |
(define (make-sum a b) | |
(cond ((=number? a 0) b) |
View deriv.scm
This file contains 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
(define (variable? x) (symbol? x)) | |
(define (same-variable? a b) (and (variable? a) (variable? b) (eq? a b))) | |
(define (sum? e) (and (pair? e) (eq? (car e) '+))) | |
(define (added e) (cadr e)) | |
(define (augend e) | |
(if (= (length e) 3) (caddr e) (append '(+) (cdr (cdr e))))) | |
(define (product? e) (and (pair? e) (eq? (car e) '*))) | |
(define (multiplier e) (cadr e)) |
View fib.scm
This file contains 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
(define (vector+vector a b) | |
(define (vector+vector-iter a b value) | |
(if (null? a) (reverse value) | |
(vector+vector-iter (cdr a) (cdr b) (cons (+ (car a) (car b)) value) ))) | |
(vector+vector-iter a b '())) | |
(display "vector+vector: ") | |
(display (vector+vector '(1 2 3) '(4 5 6))) | |
(display "\n") |
View queen.scm
This file contains 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
(define (range a b) | |
(define (iter v current) | |
(if (< v a) current | |
(iter (- v 1) (cons v current)))) | |
(iter (- b 1) '())) | |
(define (accmulate f init seq) | |
(if (null? seq) init | |
(accmulate f (f (car seq) init) (cdr seq)))) |
View angularjs
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>angularjs</title> | |
<script src="http://cdn.staticfile.org/jquery/2.1.0/jquery.min.js" type="text/javascript"></script> | |
<script src="http://cdn.staticfile.org/angular.js/1.0.8/angular.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<form name="test_form" ng-controller="TestCtrl" ng-init="o=[0,1,2,3]; a=o[1];"> |
View alipay_mobile.py
This file contains 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 -*- | |
from hashlib import md5 | |
from urllib import urlencode | |
#网关 | |
GATEWAY = 'http://wappaygw.alipay.com/service/rest.htm' | |
class Alipay(object): | |
'支付宝移动服务网关' |
View sendmail.py
This file contains 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 -*- | |
import sys, os, re | |
from lib.eml_parse import parse | |
from lib.smtpclient import SMTPClient | |
import tempfile | |
import email.utils | |
from email.mime.base import MIMEBase | |
from email.mime.text import MIMEText |
View sina_sso.py
This file contains 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 -*- | |
import rsa | |
import re | |
import time | |
import json | |
import traceback | |
from urllib import urlencode, unquote, quote | |
from Cookie import SimpleCookie | |
import tornado |
NewerOlder