| Models | Examples |
|---|---|
| Display ads | Yahoo! |
| Search ads |
๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Execute these commands in order to rebuild a virtualenv from scratch | |
| $ heroku labs:enable user-env-compile | |
| $ heroku config:set CLEAN_VIRTUALENV=yes | |
| $ heroku config:set VIRTUALENV_DIRS=.heroku/venv | |
| $ git push heroku master | |
| $ heroku config:unset CLEAN_VIRTUALENV | |
| $ heroku config:unset VIRTUALENV_DIRS | |
| $ heroku labs:disable user-env-compile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| cd ~/ | |
| wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.65.tar.gz | |
| tar -zxf mysql-5.1.65.tar.gz | |
| cd mysql-5.1.65 | |
| ./configure '--prefix=/usr' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' '--includedir=/usr/include' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-system-type=debian-linux-gnu' '--enable-shared' '--enable-static' '--enable-thread-safe-client' '--enable-assembler' '--enable-local-infile' '--with-fast-mutexes' '--with-big-tables' '--with-unix-socket-path=/var/run/mysqld/mysqld.sock' '--with-mysqld-user=mysql' '--with-libwrap' '--without-readline' '--with-ssl' '--without-docs' '--with-extra-charsets=all' '--with-plugins=max' '--with-embedded-server' '--with-embedded-privilege-control' | |
| make |
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1: Connection method | |
| with connections['default'].sscursor(): | |
| Foo.objects.all() | |
| ^^ this sucks because we make assumptions about where Foo routes | |
| #2: QuerySet method | |
| Foo.objects.all().sscursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
| <% pages.each do |p| %> | |
| <url> | |
| <loc>http://youdomain.com/<%=p.destination_path.gsub('/index.html','')%></loc> | |
| <priority>0.7</priority> | |
| </url> | |
| <% end %> | |
| </urlset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Change propagateExpire function in db.c as follows: | |
| void propagateExpire(redisDb *db, robj *key) { | |
| /* HORRIBLE HACK STARTS HERE */ | |
| /* robj *argv[2]; */ | |
| robj *argv[3]; | |
| /* HORRIBLE HACK ENDS HERE */ | |
| argv[0] = shared.del; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| module mydjangolib.bigint_patch | |
| A fix for the rather well-known ticket #399 in the django project. | |
| Create and link to auto-incrementing primary keys of type bigint without | |
| having to reload the model instance after saving it to get the ID set in | |
| the instance. | |
| Logs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # A JavaScript focussed git pre-commit hook | |
| # | |
| # It ensures that any files containing console.log() or alert() calls aren't able to be committed. | |
| # It also ensures that all JavaScript passes JSHint(which is assumed to be installed). A static code analysis tool which detects errors and potential issues from smelly JS - see http://www.jshint.com/ for more details | |
| # | |
| # Written by Damian Nicholson - @damian | |
| if git rev-parse --verify HEAD >/dev/null 2>&1 |