Skip to content

Instantly share code, notes, and snippets.

View gcollazo's full-sized avatar

Giovanni Collazo gcollazo

View GitHub Profile
var query: PFQuery = PFQuery(className: "userPhoto")
query.findObjectsInBackgroundWithBlock { [weak self] (objects, error) -> Void in
if let weakSelf = self {
println("Got \(objects.count) entries")
weakSelf.feedData = objects
weakSelf.tableView.reloadData()
}
}
@lincolnloop
lincolnloop / gist:91456
Created April 7, 2009 21:05
Django virtualenv shortcuts for ~/.bashrc
# Django virtualenv helpers
VIRTUALENV_PROJECTS=~/projects
# work on virtualenv
function workon(){
cd $VIRTUALENV_PROJECTS/$1
source bin/activate
}
# Run Django management commands
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
[alias]
st = status
ci = commit
co = checkout
br = branch
ls = branch
s = status
a = add
b = branch
d = diff
@gcollazo
gcollazo / udp_hole_punch_tester.py
Created July 16, 2011 15:16 — forked from somic/udp_hole_punch_tester.py
UDP Hole Punching test tool
#!/usr/bin/env python
#
# udp_hole_punch_tester.py - UDP Hole Punching test tool
#
# Usage: udp_hole_punch_tester.py remote_host remote_port
#
# Run this script simultaneously on 2 hosts to test if they can punch
# a UDP hole to each other.
#
# * remote_port should be identical on 2 hosts.
@jsocol
jsocol / Explain.rst
Last active September 28, 2015 07:27
@json_view decorator

I finally put this in its own package! Check out django-jsonview.

This is a decorator that guarantees a response will be JSON, and sends meaningful (to a developer) error messages. It relies on a BadRequest exception I created elsewhere, because there is no standard way of handling that in Django (frex, we should really return HTTP 400 on form validation failures but they don't make that particularly easy). That could easily be removed, though.

Get Linear Schedule for Channel: 328
Linear Schedule for Service Provider 63879 and Channel 328
--------------------------------------------
Getting airings from 2012-08-17 19:27:33.825069 to 2012-08-24 19:27:33.825069
Getting airings starting at 2012-08-17 19:27:33.825069....
News4 New York at 5 - Program 7476714 on Channel #241 WNBC
<?
if(unserialize(base64_decode($_COOKIE["geolocation"])) == "PR" || unserialize(base64_decode($_COOKIE["geolocation"])) == "US"){ ?>
<div id="minBox" style="position:absolute; width: 312px; height: 129px; top: 4px; left: -1px;">
<script language="javascript">
function validate() {
var mobile2, Carriers;
mobile2 = document.getElementById("mobile2").value;
Carriers = document.getElementById("Carriers").value;
@dadon
dadon / handlebars_translate.js
Created December 7, 2011 13:41
Django gettext in Handlebars.js templates
Handlebars.registerHelper('trans', function(fn) {
return gettext(fn(this));
});
@jpadilla
jpadilla / source.js
Last active December 14, 2015 02:49
Blimp Selenium IDE Python 2 / unittest / WebDriver
/*
* Formatter for Selenium 2 / WebDriver Python client.
*/
var subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/webdriver.js', this);
function testClassName(testName) {
return testName.split(/[^0-9A-Za-z]+/).map(
function(x) {