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
# A middlware that stores the envrionement dict inside the current | |
# thread, implement a get_request_id method for easy retrieval | |
from threading import local | |
_threadlocals = local() | |
_threadvariables = set() | |
def set_thread_variable(key, val): |
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
// https://codingcompetitions.withgoogle.com/codejam/round/000000000019fd74/00000000002b3034 | |
function readInput() { | |
const readline = require('readline') | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false | |
}) |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# pour executer ce script | |
# 1. Avoir python installé (déjà présent sur Mac ou Linux) | |
# 2. Ouvrir un Terminal (logiciel Terminal sur mac) | |
# 3. Taper dans le terminal: python <ce script> <le répértoire> > <fichier de sortie> | |
# E.g. python md5.py /Users/toto/Documents > output.txt | |
import glob | |
import hashlib | |
import sys |
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 { DogGame } from './DogBreedGame.blop' | |
def DogPage(attributes) { | |
{ state } = attributes | |
<DogGame page=state.dogPage state=state loading=state.loading> | |
= 'Dog breed game' | |
</DogGame> | |
} |
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
Goal: | |
1. Not reinventing JavaScript. Minimalistic sugar. | |
2. Aleviate the verbosness of the language especially with function definition, semicolon, and the var keyword | |
3. Avoid CoffeScript error http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffeescript/ | |
Features? Implicit return? | |
Implementation? PEG.js http://pegjs.majda.cz/online |
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
function replaceOutOfStrings(str) { | |
var index = 0, length = str.length, ch; | |
var new_str = "", inString = null, start = 0; | |
while(index < length) { | |
ch = str.charAt(index); | |
if(ch === '\\') { | |
index = index + 2; | |
continue; | |
} | |
if(ch === '"' || ch === "'") { |
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 likely = require("likely.js"); | |
var data = {list:[1, 2, 3]}; | |
var template = likely.Template([ | |
'for key, value in list', | |
' p', | |
' {{ value }}' | |
]); | |
var tree1 = template.tree(likely.Context(data)); |
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 likely = require("likely.js"); | |
var data = {list:[1, 2, 3]}; | |
var template = likely.Template([ | |
'for key, value in list', | |
' p', | |
' {{ value }}' | |
]); | |
var tree1 = template.tree(likely.Context(data)); |
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
#!/usr/bin/env python | |
import multiprocessing | |
import os | |
import sys | |
import unittest | |
from django.test.simple import DjangoTestSuiteRunner | |
def run_test_slice(test_labels, extra_tests, slice_index, number_process): | |
print "Run test slice %s" % (slice_index) | |
runner = DjangoTestSuiteRunnerSlice(slice_index=slice_index, |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |