Skip to content

Instantly share code, notes, and snippets.

View neara's full-sized avatar
🏠
Working from home

Ana neara

🏠
Working from home
View GitHub Profile
// in app.js
// Routes
var routes = require('./routes')(app);
app.get('/:controller/:action/:id', routes.get);
app.get('/:controller/:id', routes.get);
app.get('/:controller', routes.get);
app.get('/api/v2/*', routes.api);
app.get('/dev-status/:path', routes.dev_status); // this is what i want to add
class Occupation(models.Model):
event = models.ForeignKey(Event, related_name='sections')
section = models.ForeignKey(Section)
expected_capacity = models.PositiveIntegerField(
help_text='Max Capacity: %d' % self.section.crowd_capacity)
def __unicode__(self):
return self.section.name
class OccupationForm(forms.ModelForm):
@neara
neara / twython.diff
Created February 7, 2013 08:14 — forked from U2Ft/twython.diff
diff --git a/twython/twython.py b/twython/twython.py
index 49c2f65..ce6931f 100644
--- a/twython/twython.py
+++ b/twython/twython.py
@@ -14,7 +14,7 @@ import re
import warnings
import requests
-from requests.auth import OAuth1
+from requests_oauthlib import OAuth1
{
"data": [
{
"id": "340838642686446_353835951386715",
"from": {
"id": "340838642686446",
"category": "Community",
"name": "Test Page"
},
"story": "Test Page shared a status update.",
@neara
neara / gist:5845734
Created June 23, 2013 17:07
Facebook photo object that was shared.
{
"id": "340838642686446_353798958057081",
"from": {
"id": "340838642686446",
"category": "Community",
"name": "Test Page"
},
"message": "test share",
"story": "Test Page shared a photo.",
"picture": "https://fbcdn-photos-b-a.akamaihd.net/hphotos-ak-ash3/1016045_352899518147025_1275698688_s.jpg",
@neara
neara / feeds.py
Created July 28, 2013 08:07
Django RSS feed example
from django.shortcuts import get_object_or_404
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from myproject.myapp.models import Model, Broadcast, \
BroadcastSocialAccountStatus
OFFICIAL_URL = "http://mainwebsite.com/"
OFFICIAL_LOGO_URL = 'https://s3.amazonaws.com/bucketname/logo.png'
@neara
neara / forms.py
Last active June 10, 2024 15:30
Django Class Based Views and Inline Formset Example
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from models import Sponsor, Sponsorship
class SponsorForm(ModelForm):
class Meta:
model = Sponsor
@neara
neara / nginx.conf
Last active February 27, 2018 15:23
nginx configuration file for example, including web sockets supports
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@neara
neara / gist:6671854
Last active December 23, 2015 17:49 — forked from joho/gist:3735740
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/