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
#include <sys/time.h> // for gettimeofday() | |
class StopWatch { | |
timeval started; | |
std::string msg; | |
public: | |
StopWatch(const std::string& m): msg(m) | |
{ gettimeofday(&started, NULL); } |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http') | |
, path = require('path'); | |
var app = express(); |
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
express = require 'express' | |
http = require 'http' | |
path = require 'path' | |
app = express() | |
public_path = path.join __dirname, 'public' | |
app.configure -> | |
app.set 'port', process.env.PORT || 3000 |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import requests | |
def analyse_page(url): | |
r = requests.get(url) | |
assert r.status_code == 200 |
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
\documentclass{article} | |
\usepackage{python} | |
\begin{document} | |
\begin{python} | |
print "Hello world from python!" | |
\end{python} | |
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
\begin{python} | |
import os | |
print "Current directory: {0}".format(os.getcwd()) | |
\end{python} |
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
\begin{python}[initialise.py] | |
print "Current directory: {0}".format(currentDir) | |
\end{python} |
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
import os | |
currentDir = os.getcwd() |
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
\begin{equation} | |
\chi^2 = \sum \left(\frac{x_i - m_i}{\sigma_i}\right)^2 | |
\end{equation} |
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
var allowedHost = { | |
// Add your allowed hosts here | |
'http://localhost:3001': true, | |
'http://localhost:7357': true | |
}; | |
var allowCrossDomain = function(req, res, next) { | |
// If the domain is allowed, set the response headers to reflect this. Otherwise reject the authentication | |
if(allowedHost[req.headers.origin]) { | |
res.header('Access-Control-Allow-Credentials', true); |
OlderNewer