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
| /* Instantiate the global sp object; include models & views */ | |
| var sp = getSpotifyApi(1); | |
| var models = sp.require("sp://import/scripts/api/models"); | |
| // Get the track that is currently playing | |
| var currentTrack = models.player.track; | |
| // If nothing currently playing | |
| if (currentTrack == null) { | |
| $('#now-playing').append('No track currently playing'); |
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 __future__ import division | |
| import os | |
| import subprocess | |
| try: | |
| from cStringIO import StringIO | |
| except ImportError: | |
| from StringIO import StringIO |
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
| # Log switchboard stuff to logfile | |
| LOGGING['loggers']['switchboard']['handlers'] = ['logfile'] | |
| LOGGING['loggers']['switchboard']['level'] = 'WARNING' | |
| LOGGING['handlers']['logfile']['filename'] = '/var/log/apache2/capstone.savidworks.com/switchboard.log' |
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
| LOGGING = { | |
| 'version': 1, | |
| 'disable_existing_loggers': False, | |
| 'formatters': { | |
| 'verbose': { | |
| 'format': '%(asctime)s - %(name)s - %(levelname)s: %(message)s', | |
| }, | |
| 'simple': { | |
| 'format': '%(levelname)s: %(message)s', | |
| } |
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
| UPDATE pg_database SET datistemplate=FALSE WHERE datname='template1'; | |
| DROP DATABASE template1; | |
| CREATE DATABASE template1 WITH owner=postgres template=template0 encoding='UTF8'; | |
| UPDATE pg_database SET datistemplate=TRUE WHERE datname='template1'; |
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
| How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS | |
| Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing). | |
| The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here: | |
| * Heroku Hostname SSL | |
| * GoDaddy Standard SSL Certificate | |
| * Zerigo DNS |
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 | |
| """ | |
| urlnorm.py - URL normalisation routines | |
| urlnorm normalises a URL by; | |
| * lowercasing the scheme and hostname | |
| * taking out default port if present (e.g., http://www.foo.com:80/) | |
| * collapsing the path (./, ../, etc) | |
| * removing the last character in the hostname if it is '.' |
NewerOlder