Skip to content

Instantly share code, notes, and snippets.

View harikt's full-sized avatar
⛱️
Tanvish Technologies

Hari K T harikt

⛱️
Tanvish Technologies
View GitHub Profile
@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@tankist
tankist / php
Created May 4, 2011 09:13
Collection pagination example
class Model_Mapper_Db_User extends Skaya_Model_Mapper_Db_Abstract {
public function getUsersPaginator($order = null) {
$userTable = self::_getTableByName(self::TABLE_NAME);
$select = $userTable->select();
if ($order) {
$select->order($this->_mapOrderStatement($order));
}
$paginator = Skaya_Paginator::factory($select, 'DbSelect');
$paginator->addFilter(new Zend_Filter_Callback(array(
@brendano
brendano / analysis.txt
Created June 14, 2011 02:56
How much text versus metadata is in a tweet?
How much text versus metadata is in a tweet?
Brendan O'Connor (brenocon.com), 2011-06-13
http://twitter.com/brendan642/status/80473880111742976
What's it mean to compare the amount of text versus metadata?
Let's start with raw size of the data that comes over the wire from Twitter.
## Get tweets out of a sample stream archive.
## (e.g. curl http://stream.twitter.com/1/statuses/sample.json)
% cat tweets.2011-05-19 | grep -P '"text":' | head -100000 > 100k_tweets
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 10, 2024 16:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@webmozart
webmozart / composer.json
Created August 4, 2012 11:51
DON'T USE THIS GIST! Please clone https://github.com/bschussek/standalone-forms instead.
{
"require": {
"symfony/form": "2.1.*",
"symfony/validator": "2.1.*",
"symfony/templating": "2.1.*",
"symfony/framework-bundle": "2.1.*"
},
"minimum-stability": "dev"
}
@shameerc
shameerc / .bashrc
Created September 3, 2012 10:09
Show Git branch name on shell prompt
# this will show current branch name of repository in shell prompt
# add this in ~/.bashrc
export PS1="\\[\033[1;55m\]\w\$(__git_ps1 ' [%s]') \$ "