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
| """ | |
| Snippet from Django Docs | |
| """ | |
| class MultiDBModelAdmin(admin.ModelAdmin): | |
| # A handy constant for the name of the alternate database. | |
| using = 'other' | |
| def save_model(self, request, obj, form, change): | |
| # Tell Django to save objects to the 'other' database. | |
| obj.save(using=self.using) |
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
| /* | |
| Allows for ajax requests to be run synchronously in a queue | |
| Usage:: | |
| var queue = new $.AjaxQueue(); | |
| queue.add({ | |
| url: 'url', |
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
| // main.js | |
| function loadGoogleMapsApi(){ | |
| if(typeof google === "undefined"){ | |
| var script = document.createElement("script"); | |
| script.src = "https://maps.google.com/maps/api/js?sensor=false&callback=loadGoogleMapsApiReady"; | |
| document.getElementsByTagName("head")[0].appendChild(script); | |
| } else { | |
| loadGoogleMapsApiReady(); | |
| } | |
| } |
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
| .leaflet-div-icon { | |
| background: transparent; | |
| border: none; | |
| } | |
| .leaflet-marker-icon .number{ | |
| position: relative; | |
| top: -37px; | |
| font-size: 12px; | |
| width: 25px; |
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
| CREATE OR REPLACE FUNCTION network_operator(msisdn text) | |
| RETURNS text AS | |
| $$ | |
| DECLARE | |
| operator TEXT; | |
| BEGIN | |
| IF msisdn ~ '^(0|234)(703|706|803|806|810|813|816)\\d+$' THEN | |
| operator := 'MTN'; | |
| ELSEIF msisdn ~ '^(0|234)(705|805|807|815)\\d+$' THEN | |
| operator := 'GLO'; |
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 | |
| # Setup a rootfs of Fedora 15 for libvirt lxc | |
| # | |
| # The rootfs is based on http://download.openvz.org/template/precreated/fedora-15-x86_64.tar.gz | |
| # | |
| # See also | |
| # - http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg01707/lxc-fedora.in | |
| if [ $# != 1 ]; then |
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/env python | |
| # with help and inspiration from | |
| # * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure) | |
| # * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL | |
| # * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html | |
| import sys | |
| import base64 | |
| import struct |
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
| Choose a ticket class: <select id="tickets"></select> | |
| <p id="ticketOutput"></p> | |
| <script id="ticketTemplate" type="text/x-jquery-tmpl"> | |
| {{if chosenTicket}} | |
| You have chosen <b>${ chosenTicket().name }</b> | |
| ($${ chosenTicket().price }) | |
| <button data-bind="click: resetTicket">Clear</button> | |
| {{/if}} |
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 | |
| # | |
| # => $ sudo apt-get install -y --force-yes curl; sudo su - -c "bash < <(curl -sL http://is.gd/..........)" | |
| # | |
| # Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine. | |
| # -------------------------------------------------------------------------- | |
| # | |
| # Steps: | |
| # | |
| # *) Install required packages (git, postgresql, etc.) |
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( |