Skip to content

Instantly share code, notes, and snippets.

View idan's full-sized avatar
💫
Prototypin'

Idan Gazit idan

💫
Prototypin'
View GitHub Profile
@idan
idan / python_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@idan
idan / css_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@idan
idan / pattern.es6
Created August 3, 2015 07:25
ES6 object argument pattern
function foo ({required, optional='default!'} = {}) {
console.debug(`${required}, ${optional}`)
}
foo({required: 'lala', optional: 'lolo'})
// -> "lala, lolo"
foo({required: 'lala', optional: null})
// -> "lala, null"
#import <Python/Python.h>
int main(int argc, char *argv[])
{
PyObject *psrcstring, *pwriter_name_string, *pmodule, *pmethod, *presult;
PyTupleObject *pmethodargs;
PyDictObject *pmethodnamedargs;
char *output;
char *source = "Djoosh \n======\n\n`Djoosh`_ is a reusable django app which provides extensible, pure-python fulltext indexing for Django models using the `Whoosh`_ information-retrieval library. \n\nThe djoosh project lives at http://github.com/idangazit/djoosh/.\n\n.. _Djoosh: http://github.com/idangazit/djoosh/\n\n\nProject Goals\n-------------\n\nDjoosh will:\n \n * be a **pure-python** fulltext indexing solution. There are many fine solutions based around `Lucene`_ and `Solr`_ (java), or `Xapian`_ (C/C++). There is even one solution (`django-search`_) which provides pluggable indexing backends much like the ORM supports various DB backends. This project utilizes `Whoosh`_ exclusively.\n * be simple enough to make \"**out of the box indexing**\" no harder than registering a
#import <Python/Python.h>
int main(int argc, char *argv[])
{
PyObject *psrcstring, *pwriter_name_string, *pmodule, *pmethod, *presult;
PyTupleObject *pmethodargs;
PyDictObject *pmethodnamedargs;
char *output;
char *source = "Djoosh \n======\n\n`Djoosh`_ is a reusable django app which provides extensible, pure-python fulltext indexing for Django models using the `Whoosh`_ information-retrieval library. \n\nThe djoosh project lives at http://github.com/idangazit/djoosh/.\n\n.. _Djoosh: http://github.com/idangazit/djoosh/\n\n\nProject Goals\n-------------\n\nDjoosh will:\n \n * be a **pure-python** fulltext indexing solution. There are many fine solutions based around `Lucene`_ and `Solr`_ (java), or `Xapian`_ (C/C++). There is even one solution (`django-search`_) which provides pluggable indexing backends much like the ORM supports various DB backends. This project utilizes `Whoosh`_ exclusively.\n * be simple enough to make \"**out of the box indexing**\" no harder than registering a
#import <Python/Python.h>
int main(int argc, char *argv[])
{
PyObject *psrcstring, *pwriter_name_string, *pmodule, *pmethod, *presult;
PyTupleObject *pmethodargs;
PyDictObject *pmethodnamedargs;
char *output;
char *source = "Djoosh \n======\n\n`Djoosh`_ is a reusable django app which provides extensible, pure-python fulltext indexing for Django models using the `Whoosh`_ information-retrieval library. \n\nThe djoosh project lives at http://github.com/idangazit/djoosh/.\n\n.. _Djoosh: http://github.com/idangazit/djoosh/\n\n\nProject Goals\n-------------\n\nDjoosh will:\n \n * be a **pure-python** fulltext indexing solution. There are many fine solutions based around `Lucene`_ and `Solr`_ (java), or `Xapian`_ (C/C++). There is even one solution (`django-search`_) which provides pluggable indexing backends much like the ORM supports various DB backends. This project utilizes `Whoosh`_ exclusively.\n * be simple enough to make \"**out of the box indexing**\" no harder than registering a
whatever.com (directory under source control)
|
|+ templates (django templates for this site)
|+ media (contains media, css, js, etc needed for this specific site)
|- project (the django project directory)
|- settings.py
|- urls.py
|+ app1
|+ app2
|+ env (the virtualenv directory, which isn't under source control via .gitignore or similar)
def auth_return(request):
# this is the view which google returns the browser to after getting an authsub token
token = request.REQUEST['token']
request.session['token'] = token
return HttpResponseRedirect('/someotherview/')
def some_other_view(request):
token = session['token']
# .. use the token
# import django-related bits, including my own form code from elsewhere
from django.http import HttpResponseRedirect, HttpResponseServerError
from django.shortcuts import render_to_response
from contacts_manager.forms import *
# importing the gdata stuff
from gdata.contacts.service import ContactsService
from gdata.alt.appengine import run_on_appengine
from gdata.auth import generate_auth_sub_url, extract_auth_sub_token_from_url
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sitewide Prefix {% block title %}{% endblock title %}</title>
<link rel="stylesheet" href="{{ MEDIA_URL }}css/reset.css" type="text/css" media="all" charset="utf-8">
<link rel="stylesheet" href="{{ MEDIA_URL }}css/960.css" type="text/css" media="all" charset="utf-8">
<link rel="stylesheet" href="{{ MEDIA_URL }}css/local.css" type="text/css" media="all" charset="utf-8">
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> -->