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
<div class="_all_wplink_rwPUIFu9_cc" style="position:absolute;opacity:0.001;z-index:10;filter:alpha(opacity=0)"> | |
... spammy text and links to knockoff fashion sites ... | |
</div> |
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
<form action="//formspree.io/[email protected]" method="POST"> | |
<input type="text" name="name"> | |
<input type="email" name="_replyto"> | |
<input type="submit" value="Send"> | |
</form> |
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
class Tenancy(models.Model): | |
building = models.ForeignKey(Building) |
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
class Building(models.Model): | |
owner = models.ForeignKey(User) |
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
class BuildingForm(CustomModelForm): | |
pass |
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
class CustomModelForm(forms.ModelForm): | |
""" | |
Sandboxes user data for each reference field pointing to an | |
object with an "owner" field. | |
""" | |
def __init__(self, request, *args, **kwargs): | |
# cache the request object | |
self.request = request | |
init_result = super(CustomModelForm, self).__init__(*args, **kwargs) |
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
#! /usr/bin/python | |
""" | |
This script generates a random EAN13 number and prints it to the standard out. | |
""" | |
from random import randrange | |
def generate_12_random_numbers(): | |
numbers = [] | |
for x in range(12): | |
numbers.append(randrange(10)) |
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
<a class="track" target="_blank" href="/my-tracked-page-link">TRACKED LINK</a> |
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
/** | |
* Track clicks to a link. If new_window is true the google analytics request | |
* will be made synchronously, because browsers block new windows from opening unless | |
* it is done DURING an on click event. If new_window is false, the request will | |
* be made asynchronously, and the current window url will be changed. | |
*/ | |
var trackOutboundLink = function(url, new_window) { | |
ga('send', 'event', 'outbound', 'click', url, {'hitCallback': | |
function () { | |
if (!new_window) { |
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
import base64 | |
from osv import osv, fields | |
class my_class(osv.osv_memory): | |
def get_file(self, cr, uid, ids, field_name=None, arg=None, context=None): | |
result = dict.fromkeys(ids) | |
for record_browse in self.browse(cr, uid, ids): | |
f = open(record_browse.file_path) | |
result[record_browse.id] = base64.encodestring(f.read()) |