View md5.py
#!/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 |
View DogPage.blop
import { DogGame } from './DogBreedGame.blop' | |
def DogPage(attributes) { | |
{ state } = attributes | |
<DogGame page=state.dogPage state=state loading=state.loading> | |
= 'Dog breed game' | |
</DogGame> | |
} |
View Js sugar
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 |
View expression.js
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 === "'") { |
View index.js
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)); |
View index.js
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)); |
View splicer.py
#!/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, |
View Supervisord startup
#! /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. |