Skip to content

Instantly share code, notes, and snippets.

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")
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: ->
.editable {
padding: 4px 8px;
input, textarea {
display: none;
margin: 0;
padding: 0;
border: 0;
background: transparent;
color: #aaa;
text-shadow: 0 1px 0 #666;
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 =
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))
def def_scope(name, &block)
singleton_class.send(:define_method, name) do |*args|
klass = clone
klass.instance_eval(block.curry[*args])
klass
end
end
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);
<?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">
@aligo
aligo / miao.py
Created August 2, 2012 13:07
miao
# -*- 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)
@aligo
aligo / miao2.py
Created August 3, 2012 01:59
miao2
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