Skip to content

Instantly share code, notes, and snippets.

View gcollazo's full-sized avatar

Giovanni Collazo gcollazo

View GitHub Profile
<a href="http://startupsofpuertorico.com/barcamp/" title="Barcamp Mayaguez"><img src="http://dl.dropbox.com/u/1364069/elweb_files/barcamp_m.png" alt="Barcamp Mayaguez" style="border:0"></a>

BarcampCheckin

A very simple backend to save data from the check-in app.

Endpoints

/event/[event_id]/

  • GET Request will return a list of all the users that already checked in. It will return something like.

     [
    

{"user":"1234567890", "checked_in": false},

@gcollazo
gcollazo / gist:2009697
Created March 10, 2012 01:58
JavaScript: CSRF Token in Backbone.js sync
var oldSync = Backbone.sync;
Backbone.sync = function(method, model, options){
options.beforeSend = function(xhr){
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN);
};
return oldSync(method, model, options);
};
def save(self, *args, **kwargs):
if self.name == "Yoko Ono's blog":
return # Yoko shall never have her own blog!
else:
super(Blog, self).save(*args, **kwargs) # Call the "real" save() method.
public class Movie
{
public int ID { get; set; }
public string Title { get; set; }
public DateTime ReleaseDate { get; set; }
public string Genre { get; set; }
public decimal Price { get; set; }
}
@gcollazo
gcollazo / cocoa_keypress_monitor.py
Created June 29, 2012 19:14 — forked from ljos/cocoa_keypress_monitor.py
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
# cocoa_keypress_monitor.py by Bjarte Johansen is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
from Cocoa import NSApp, NSEvent, NSKeyDownMask
from Foundation import NSApplication, NSObject, NSLog
from PyObjCTools import AppHelper
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
mask = NSKeyDownMask
NSEvent.addGlobalMonitorForEventsMatchingMask_handler_(mask, handler)
@gcollazo
gcollazo / npm-debug.log
Created August 5, 2012 15:55
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ]
2 info using npm@1.1.28
3 info using node@v0.8.5
4 verbose node symlink /usr/local/bin/node
5 verbose config file /Users/gcollazo/.npmrc
6 verbose config file /usr/local/etc/npmrc
7 verbose config file /usr/local/lib/node_modules/npm/npmrc
8 verbose readDependencies using package.json deps
9 verbose install where, deps [ '/Users/gcollazo/Dropbox/Projects/SocialShowsV2/social_shows/core/static',
/* gettext library */
var catalog = new Array();
function pluralidx(count) { return (count == 1) ? 0 : 1; }
function gettext(msgid) {
var value = catalog[msgid];
Traceback (most recent call last):
File "/Users/gcollazo/.virtualenvs/socialshows/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/Users/gcollazo/.virtualenvs/socialshows/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/Users/gcollazo/.virtualenvs/socialshows/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/Users/gcollazo/.virtualenvs/socialshows/lib/python2.7/site-packages/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Users/gcollazo/.virtualenvs/socialshows/lib/python2.7/site-packages/django/core/handlers/base.py", line 221, in handle_uncaught_exception
context =
name: socialshows.models.UserModel.get('name')
recipient: resp.name
other: other
program: @model.get('program').name
string = gettext("%(name)s invited %(recipient)s %(other)s to %(program)s")
@postToWall interpolate string, context, yes