Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| var a = [1,2,3,4,5,6,7,8]; | |
| Array.prototype.map = function(callback) { | |
| var mapped = []; | |
| for (var i = 0; i < this.length; i++) { | |
| mapped[i] = callback.call(null, this[i]); | |
| } | |
| return mapped; | |
| }; | |
| <?php | |
| class Vkapi { | |
| protected $_access_token = '%access_token%'; | |
| protected $_client_id = 0; | |
| public static function factory () | |
| { | |
| $class = get_class(); |
| <?php | |
| function slugify($text) { | |
| return strtolower(strtr(trim($text), array(' '=>'_') )); | |
| } | |
| function translit($str){ | |
| static $tbl= array( | |
| 'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ж'=>'g', 'з'=>'z', | |
| 'и'=>'i', 'й'=>'y', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o', 'п'=>'p', |
| #! /usr/bin/env python | |
| from os import fork, chdir, setsid, umask | |
| from sys import exit | |
| def main(): | |
| while 1: | |
| #main daemon process loop | |
| # Dual fork hack to make process run as a daemon |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import sys, time, json, logging | |
| import pika | |
| hostname = 'localhost' | |
| logging.getLogger('pika').setLevel(logging.ERROR) | |
| class RabbitMQ(object): | |
| def __init__(self, hostname, queue, exchange = ''): | |
| self.hostname = hostname |
| from argparse import ArgumentParser | |
| from math import sqrt | |
| from urllib import urlencode | |
| import sys | |
| MAX_SIZE = 300000 | |
| def main(): |
| require 'formula' | |
| class Thrift < Formula | |
| homepage 'http://thrift.apache.org' | |
| # The thrift.apache.org 0.9.1 archive is missing PHP ext, fixed in THRIFT-2129 | |
| # By grapping the source from git instead, it's fixed, but we need to bootstrap | |
| url 'https://git-wip-us.apache.org/repos/asf/thrift.git', :branch => "0.9.1" | |
| version "0.9.1" | |
| head do |
| #!/bin/bash | |
| # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
| yum groupinstall "Development tools" | |
| yum install zlib-devel | |
| yum install bzip2-devel openssl-devel ncurses-devel | |
| wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 | |
| tar xf Python-2.7.3.tar.bz2 | |
| cd Python-2.7.3 |