Skip to content

Instantly share code, notes, and snippets.

View ionelmc's full-sized avatar
🙃
wat

Ionel Cristian Mărieș ionelmc

🙃
wat
View GitHub Profile
@jezdez
jezdez / pip.conf
Created March 10, 2010 14:57
My ~/.pip/pip.conf. More information here: http://pip.openplans.org/configuration.html
[global]
default-timeout = 60
respect-virtualenv = true
download-cache = ~/.pip/cache
log-file = ~/.pip/pip.log
build = ~/.pip/build
[install]
use-mirrors = true
from nonlocal_ import nonlocal_
def foo():
a = 1
def bar():
nonlocal_('a')
a = 2
bar()
return a
"""Example usage:
In [1]: !cat ayy.s
.text
.global _start
.type _start, @function
_start:
movq $10, %rdx
pushw $10
@amcgregor
amcgregor / app-server.textile
Created April 10, 2011 02:40
An overview of some ideas for a Python application server.

Application Management Server

Web-based interface (w/command-line tools) for managing:

  1. Application server configuration.
    1. SSH keys, etc.
  2. Application installation.
    1. Drop a .zip (or .egg, more on this below) into a folder.
    2. Upload the same via web interface.
    3. Enter the URL of a SCM system for checkout and deployment.
@chernjie
chernjie / git-gh-setup.sh
Created February 9, 2015 09:25
Fetch Github's Pull Request as a remote branch
#!/usr/bin/env bash
git remote -v | grep fetch | grep github | \
while read remote url _; do
if ! git config --get-all "remote.$remote.fetch" | grep -q refs/pull
then
git config --add "remote.$remote.fetch" \
'+refs/pull/*/head:refs/remotes/'"$remote"'/pull/*'
fi
done
import sys
import tornado.ioloop
import psycopg2
import psycopg2.extensions
io_loop = tornado.ioloop.IOLoop.instance()
conn = psycopg2.connect('dbname=mytest user=lbolla password=secret')
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
@vegasje
vegasje / usability.md
Last active March 9, 2020 19:30
PLEASE DO NOT USE THIS. See http://userium.com/ instead.

PLEASE DO NOT USE THIS. See http://userium.com/ instead.

Usability Checklist

User Experience

  • Personalized features. Currency, language, country specific deals, taxes, or delivery options are changed based on user's location.
  • Registering provides value to users. For example a "Free Trial" button communicates a clear benefit, but a "Register" button doesn't. Unnecessary registration is avoided.
@manojpandey
manojpandey / gotchas.md
Last active August 31, 2021 14:52
Attack of Pythons

Attack of Pythons

Among computer programmers, a “gotcha” has become a term for a feature of a programming language that is likely to play tricks on you to display behavior that is different than what you expect.

Just as a fly or a mosquito can “bite” you, we say that a gotcha can “bite” you. So, let's proceed to examine some of Python's gotchas !

alt text


@sharoonthomas
sharoonthomas / cached_property.py
Created January 25, 2012 01:02
Python cached property implementation
class cached_property(object):
"""A decorator that converts a function into a lazy property. The
function wrapped is called the first time to retrieve the result
and then that calculated result is used the next time you access
the value::
class Foo(object):
@cached_property
def foo(self):
@mbrochh
mbrochh / models.py
Created September 28, 2011 12:14
Attach the django-shop cart to a User that started shopping anonymously
# add this soewhere where it gets loaded very early, i.e.
# your shop's models.py
from django.contrib.auth import login
from django.contrib.auth.signals import user_logged_in
from django.dispatch import receiver
from registration.signals import user_activated
from shop.models.defaults.cart import Cart