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
parts = path.split('/') | |
if len(parts) == 2: | |
minisite_name = parts[0] | |
page_name = parts[1] | |
minisite = GetKindByName('Minisite', minisite_name) | |
if minisite is not False: | |
page = memcache.get(path) | |
if page: | |
expires_date = datetime.datetime.utcnow() + datetime.timedelta(days=10) | |
expires_str = expires_date.strftime("%d %b %Y %H:%M:%S GMT") |
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
class Hao.Clip.Views.PiecesNew extends Backbone.View | |
id: "pieces-new" | |
events: | |
"change #files-upload": "changeFilesInput" | |
"click a#btn-upload": "uploadFiles" | |
"click a#btn-clear": "clearFiles" | |
render: -> |
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
.editable { | |
padding: 4px 8px; | |
input, textarea { | |
display: none; | |
margin: 0; | |
padding: 0; | |
border: 0; | |
background: transparent; | |
color: #aaa; | |
text-shadow: 0 1px 0 #666; |
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
save_changes_common = | |
sync: (method, model, options) -> | |
if method == 'update' && model.changedAttributes() | |
options.data = JSON.stringify(model.changedAttributes()) | |
options.contentType = 'application/json'; | |
Backbone.sync.call(this, method, model, options) | |
save_changes_model = |
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
wait_get = | |
waitGet: (id, callback) -> | |
self = this | |
model = @get(id) | |
if model? | |
callback.call(this, model) | |
else | |
@on('reset', (-> | |
callback.call(self, self.get(id)) |
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
def def_scope(name, &block) | |
singleton_class.send(:define_method, name) do |*args| | |
klass = clone | |
klass.instance_eval(block.curry[*args]) | |
klass | |
end | |
end |
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
x=[1:1006]; | |
w=1.2; | |
x=sin(w.*x); | |
q(1)=0; | |
q(2)=0; | |
for i=3:1005, | |
q(i)=1.5*q(i-1)-0.7*q(i-2)+x(i-1)+0.5*x(i-2)+randn(1,1); | |
end | |
for i=1:1000, | |
q(i)=q(i+2); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<link rel="selenium.base" href="http://www.gewara.com/register.xhtml" /> | |
<title>Miao</title> | |
</head> | |
<body> | |
<table cellpadding="1" cellspacing="1" border="1"> |
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 selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
from selenium.webdriver.common.keys import Keys | |
from tesseract import image_to_string | |
from urllib import urlretrieve | |
import random, time, Image | |
driver = webdriver.Firefox() | |
driver.implicitly_wait(3) |
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
from urllib import urlretrieve | |
from tesseract import image_to_string | |
import requests, random, time, re, Image | |
start_point = time.time() | |
def r_timestamp(): | |
return str(int(time.time()*1000)) | |
miao = 0 |
OlderNewer