Skip to content

Instantly share code, notes, and snippets.

View gerhc's full-sized avatar

German Hoffman gerhc

  • Tryolabs
  • Montevideo
View GitHub Profile
// add the filter to your application module
angular.module('yourAppName', ['filters']);
/**
* Truncate Filter
* @Param string
* @Param int, default = 10
* @Param string, default = "..."
* @return string
*/
@gerhc
gerhc / b64field.py
Created October 15, 2012 12:28 — forked from klipstein/b64field.py
Base64 file handling for django-tastypie
import base64
import os
from tastypie.fields import FileField
from django.core.files.uploadedfile import SimpleUploadedFile
class Base64FileField(FileField):
"""
A django-tastypie field for handling file-uploads through raw post data.
It uses base64 for en-/decoding the contents of the file.
Usage:
#!/bin/sh
/home/omab/x.py &
LASTPID=$!
sleep 1m
kill $LASTPID