Skip to content

Instantly share code, notes, and snippets.

Themis Savvidis sawidis

View GitHub Profile
View gist:d03556cd850f777009da
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
View .gitignore
messages.htm
messages.json
View tx set
#!/bin/sh
PROJECT_SLUG="myproject"
for resource in $(find trunk/tr/messages -name '*.po' -type f); do
resource_slug=$(basename "$resource" ".po")
resource_identifier="${PROJECT_SLUG}.${resource_slug}"
tx set --auto-local \
-r "$resource_identifier" "trunk/<lang>/messages/${resource_slug}.po" \
@sawidis
sawidis / truncator.py
Created Jun 13, 2012
largen number truncator
View truncator.py
#!/usr/bin/env python
def humanize_wordcount(value, lower_bound=10**3, upper_bound=10**12):
"""
Similar to humanize's intword. Converts a large integer to a friendly text
representation. For example, 1000 becomes '1K', 1000000 becomes '1M' etc.
"""
try:
value = int(value)
except (TypeError, ValueError):
You can’t perform that action at this time.