Skip to content

Instantly share code, notes, and snippets.

View lardissone's full-sized avatar

Leandro Ardissone lardissone

View GitHub Profile
/*
Theme Name: Breeze theme
Theme URI:
Description:
Version: 1.0
Author: Freshout
Tags:
*/
@lardissone
lardissone / contacts.php
Created October 16, 2010 20:31
Access Google Contacts
<?php
/************************
* Google Contact importer
*
* Asks for permissions to provide access to your Gmail/Google contacts
* to the given site.
*************************/
// include all required components from Zend Gdata
// from: http://framework.zend.com/download/gdata
@lardissone
lardissone / gist:630248
Created October 16, 2010 20:43
Generate Private Certificates and Keys
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj '/C=US/ST=CA/L=Mountain View/CN=yourdomain.com' -keyout myrsakey.pem -out myrsacert.pem
@lardissone
lardissone / gist:633091
Created October 18, 2010 21:23
Center element on screen
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
@lardissone
lardissone / smtpd.sh
Created December 17, 2010 18:23
SMTP development server in Python
python -m smtpd -n -c DebuggingServer localhost:1025
@lardissone
lardissone / gist:1377470
Created November 18, 2011 19:19
Google Music play/pause service
on run
tell application "Google Chrome"
set musicTab to (first tab of every window whose title contains "Music Beta")
try
execute musicTab javascript "SJBpost('playPause');"
end try
end tell
end run
@lardissone
lardissone / settings.py
Created January 11, 2012 16:05
Subdomain middleware
# ...
SUBDOMAINS = {
'manager': {
'urlconf': 'urls',
'domain': 'manager.domain.com'
},
'clients': {
'urlconf': 'clients.urls',
'domain': 'clients.domain.com'
@lardissone
lardissone / mongodb_autoincrement.py
Created March 14, 2012 01:35
Implementation of auto_increment for MongoDB
"""
db.seq.insert({_id: 'pacientes', seq: 1})
"""
from django.conf import settings
from pymongo import Connection
DATABASES = settings.DATABASES
@lardissone
lardissone / gist:2152225
Created March 21, 2012 20:03
Nginx config file to serve static file over POST
server {
listen 80;
client_max_body_size 4G;
access_log /var/sites/webapp/logs/access.maintenance.log;
error_log /var/sites/webapp/logs/error.maintenance.log info;
server_name api.webapp.com;
# this guy redirects any path to /api.json
{
"something": [
"item 1",
"item 2",
"item 3",
"....",
"item n"
]
}