View bechmark-pages-creator.py
# Allow to create pages for testing purposes
from datetime import datetime
import random
import string
import shutil
import os
def generateWord():
View summary_tool.py
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
View SASS Responsive mixin
// _responsive_mixin.scss
$font : "Lato", sans-serif;
// Text Colors
$text-color: #111;
$text-light-color: #B9B9B9;
$text-lighter-color: #fff;
$text-dark-color: #1E1E1E;
$text-darker-color: #111;
View example_image_utils.py
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
View .bash_profile
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
View gist:38895305786610152efa
While I was working on a personal project, I decided to compare foreach vs array_map to iterate over a large set of items.
So to support my decision, I ran a benchmark on both foreach and array_map.
With a simple array of 1,000,000 objects, I iterate over them with foreach and array_map. And surprisingly, foreach ran in 0.24sec average, while array_map took over 3.30sec.
Also array_map ran out of memory, I had to do an ini_set("memory_limit","512M"); to at least get some results.
My system:
Macbook
View gist:9588024
#!/usr/bin/env python
# sample usage: checksites.py eriwen.com nixtutor.com yoursite.org
import pickle, os, sys, logging
from httplib import HTTPConnection, socket
from smtplib import SMTP
def email_alert(message, status):
fromaddr = 'you@gmail.com'
View sqlalchemy_example.py
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
View vhost.py
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
import getopt
#
# Show Usage, Output to STDERR
View Voodoo\CanOfSpam.php
<?php
/**
* CanOfSpam, a PHP 5.4 implementation to parse and get random spam text for blog comments
* -> https://gist.github.com/shanselman/5422230
*
* License: MIT
* Author : Mardix - http://github.com/mardix
*
* How to use
*