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
// defining a function | |
var async_factorial = function(n, callback){ | |
console.log("step1"); | |
var fact = 1; | |
process.nextTick(function(){ | |
for(var i=1; i<n; i++) { | |
fact = fact*i; | |
} | |
console.log("step2"); | |
callback(fact); |
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
var http = require('http'); | |
var server = http.createServer(function(request, response) { | |
response.write("Hello World"); | |
response.end(); | |
}) | |
server.listen(8888); | |
console.log("Server Started") |
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 lettuce import * | |
@step('I have the number (\d+)') | |
def have_the_number(step, number): | |
world.number = int(number) | |
@step('I compute its fibonacci') | |
def compute_its_fibonacci(step): | |
world.number = fibonacci(world.number) |
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
Feature: Compute fibonacci | |
In order to play with Lettuce | |
As beginners | |
We'll implement fibonacci | |
Scenario: Fibonacci of 0 | |
Given I have the number 0 | |
When I compute its fibonacci | |
Then I see the number 1 |
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
<html> | |
<head> | |
<title> More Like </title> | |
</head> | |
<body> | |
<FORM action="/morelikethis" method="POST"> | |
Document:<input type=text name=path> | |
<input type="submit" name="submit"> | |
</FORM> | |
</body> |
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
import whoosh,os | |
from whoosh import index | |
import whoosh.index | |
import whoosh.fields | |
import whoosh.qparser | |
import tornado.ioloop | |
import tornado.web | |
class Search(object): | |
def __init__(self, indexdir, searchstr=None): |
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
<html> | |
<head> | |
<title> Search </title> | |
</head> | |
<body> | |
<FORM action="/search" method="get"> | |
<input type=text name=q> | |
<input type="submit" name="submit"> | |
</FORM> | |
</body> |
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
import whoosh,os | |
from whoosh import index | |
import whoosh.index | |
import whoosh.qparser | |
import tornado.ioloop | |
import tornado.web | |
class Search(object): | |
def __init__(self, indexdir, searchstr): | |
self.indexdir = indexdir |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Upload Form</title> | |
</head> | |
<body> | |
<p><h1>Select & Upload</h1></p> | |
<form enctype="multipart/form-data" action="/upload" method="post"> | |
File: <input type="file" name="filearg" /> | |
<br /> |
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
import tornado | |
import tornado.ioloop | |
import tornado.web | |
import os, uuid | |
__UPLOADS__ = "uploads/" | |
class Userform(tornado.web.RequestHandler): | |
def get(self): | |
self.render("fileuploadform.html") |