Skip to content

Instantly share code, notes, and snippets.

View akoumjian's full-sized avatar

Alec Koumjian akoumjian

View GitHub Profile
#!/usr/bin/env python
def foo(bar):
"""
Documentation goes here.
"""
bar += 1
return bar
@akoumjian
akoumjian / hello_world.py
Created October 2, 2011 03:48
Hello World
def hello(foo):
"""Testing Github gist to see how embedding works."""
foo += 5
return foo
@akoumjian
akoumjian / indexof_example.js
Created October 31, 2011 19:28
indexof example
var myCars=["Saab","Volvo","BMW"]; // literal array
if (myCars.indexOf("Saab")) {
console.log("It's in the list!")
}
else {
console.log("Nope, not there.")
}
@akoumjian
akoumjian / plupload_s3_django.html
Created December 7, 2011 20:26
plupload s3 django snippet
<script type="text/javascript">
$(document).ready(function () {
$('#uploader').plupload({
runtimes : 'flash,silverlight',
url : '{{ s3.url }}',
max_file_size : '1000MB',
multipart: true,
multipart_params: {
'key': '{{ s3.key }}', // use filename as a key
@akoumjian
akoumjian / gist:1625609
Created January 17, 2012 08:17
Celery Task as Tastypie One Use Resource
@task
def temp_resource(foo, bar):
"""
Generate a temporary resource for use in Tastypie
"""
value1 = foo**2
value2 = foo * bar
return {'field_one': value1, 'field_two': value2}
@akoumjian
akoumjian / gist:1625633
Created January 17, 2012 08:23
Tastypie One Time Retrieval Resource Using Celery Task as object_class
class TempResource(Resource):
class Meta:
resource_name = 'temp_resource'
object_class = temp_resource.delay
authorization = Authorization()
allowed_methods = ['post', 'get']
always_return_data = True
def get_resource_uri(self, bundle_or_obj):
"""
@akoumjian
akoumjian / webserver.sls
Created February 10, 2012 01:44
virtualenv.manage not found...
local:
Data failed to compile:
----------
State virtualenv.manage found in sls webserver is unavailable
@akoumjian
akoumjian / webserver.sls
Created February 10, 2012 03:30
require not working
app-pkgs:
pkg:
- latest
- names:
- python-virtualenv
- python-dev
- libmysqlclient-dev
- libxml2-dev
- mercurial
- git
@akoumjian
akoumjian / webserver.sls
Created February 10, 2012 06:54
broken virtualenv module
/var/www/env/:
virtualenv:
- manage
- no_site_packages: True
- require:
- pkg: python-virtualenv
python-virtualenv:
pkg:
- installed
@akoumjian
akoumjian / base64.js
Created February 22, 2012 22:07
base64 encoding decoding fro webtoolkit.info
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property