Skip to content

Instantly share code, notes, and snippets.

View arnaudsj's full-sized avatar

Sébastien Arnaud arnaudsj

View GitHub Profile
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
@progrium
progrium / noded.py
Created May 18, 2010 02:47
twistd-style nodejs daemonizer
#!/usr/bin/env python
# Copyright (c) 2010 Jeff Lindsay
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
//Run test suite (flip to false to disable)
if (true) {
// Add additional unit tests to this include statement, after runner is included
Ti.include('runner.js','my_tests.js');
unitTest.run(); //optionally pass in a suite of tests - unitTest.run('suiteOne')
}
/*
proxy with pooling
Copyright (c) 2010 Mikeal Rogers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
#######################
#### DOCUMENTATION ####
#######################
#
# Run as:
#
# ruby phonegap-sc.rb APP_NAME
# ruby phonegap-sc.rb APP_NAME PROJECT_PATH
# ruby phonegap-sc.rb APP_NAME PROJECT_PATH OUTPUT_PATH
#
@karmi
karmi / tophashes-sliding-window-redis.sh
Created December 7, 2010 10:06
Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
# Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
redis-cli del tophashes:2010-12-07-08-00
redis-cli del tophashes:2010-12-07-09-00
redis-cli del tophashes:current
echo '=== 8:00 AM ==='
require.extensions[".json"] = function (module, filename) {
module.exports = JSON.parse(require("fs").readFileSync(filename, "utf8"))
}
@lamberta
lamberta / ti-tools.sh
Created April 14, 2011 06:48
Command line interface for creating and building Titanium Mobile Android projects.
#!/usr/bin/env bash
## Command line interface for creating and building Titanium Mobile Android projects.
TI_SRC="$HOME/local/src/titanium_mobile"
TI_SDK="$TI_SRC/dist/mobilesdk/linux/1.7.0"
TI_VERSION_TAG="1_7_0_preview"
ANDROID_HOME=${ANDROID_HOME:-"$HOME/local/lib/android-sdk"}
JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-6-sun"} #sun-java6-sdk
PROJECT_HOME="$HOME/projects/ti"
@madrobby
madrobby / README.md
Created May 17, 2011 16:34 — forked from 140bytes/LICENSE.txt
Luhn10 algorithm

Implementation of the Luhn 10 algorithm to check validity of credit card numbers. See http://en.wikipedia.org/wiki/Luhn_algorithm for details on the algorithm.

var validCreditCard = function(a,b,c,d,e){for(d=+a[b=a.length-1],e=0;b--;)c=+a[b],d+=++e%2?2*c%10+(c>4):c;return!(d%10)};

validCreditCard('378282246310005'); //=> true
validCreditCard('378282246310006'); //=> false

// some numbers to test with
// 378282246310005 371449635398431 378734493671000
@arnaudsj
arnaudsj / gist:1004483
Created June 2, 2011 13:57
Titanium SDK 1.7.0.RC1 updated build script for universal build with simulator type passed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Build and Launch iPhone Application in Simulator or install
# the application on the device via iTunes
#
import os, sys, uuid, subprocess, shutil, signal, string, traceback, imp
import platform, time, re, run, glob, codecs, hashlib, datetime, plistlib
from compiler import Compiler