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
const express = require('express') | |
const fs = require('fs') | |
const app = express() | |
const port = 3000 | |
app.use(express.json()) | |
app.get('/', (req, res) => { | |
fs.readFile('index.html', 'utf-8', (err, data) => { |
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"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="root"> | |
<root>HEY!!!</root> | |
</xsl:template> | |
</xsl:stylesheet> |
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 sys | |
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
HandlerClass = SimpleHTTPRequestHandler | |
ServerClass = BaseHTTPServer.HTTPServer | |
Protocol = "HTTP/1.0" | |
if sys.argv[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
$(function(){ | |
window.TastypieCollection = Backbone.Collection.extend({ | |
parse: function(response) { | |
this.recent_meta = response.meta || {}; | |
return response.objects || response; | |
} | |
}); | |
window.TastypieModel = Backbone.Model.extend({ | |
base_url: function() { |
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
""" Wrapper for BaseHTTPServer.HTTPServer class. Runs server in other thread and allow | |
to stop and start server """ | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
import socket | |
import urllib2 | |
from threading import Thread | |
import time | |
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 datetime import datetime | |
import redis | |
import random | |
import sqlite3 | |
BROKER_HOST = "localhost" # Maps to redis host. | |
REDIS_PASSWORD = None | |
KEY_PREFIX = "speed_" | |
ALPHABETE = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM" | |
SQLITE_DB = ":memory:" |
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 threading | |
from task.models import Task | |
from django.test import TestCase | |
class TestThread(TestCase): | |
def test_run(self): | |
ts = [Job() for x in range(5)] | |
for t in ts: | |
t.start() |