Skip to content

Instantly share code, notes, and snippets.

View jasonferrier's full-sized avatar
👨‍💻

Jason Ferrier jasonferrier

👨‍💻
View GitHub Profile
@jasonferrier
jasonferrier / gist:1944396
Created February 29, 2012 21:12
jQuery noConflict in *different namespace* in order to continue using one or more jQuery versions
<!-- Jquery for fancy things!-->
<script language="JavaScript" src="/js/public/jquery-latest.min.js" type="text/javascript"></script>
<script>
// to make fancy buttons. Uses noConflict just in case
var $jQ = jQuery.noConflict();
// Use jQuery via $j(...)
$jQ(document).ready(function(){
@jasonferrier
jasonferrier / tnt migration
Created April 25, 2012 23:25
migration issue
[2168][jasonferrier.jlfMBP: tntsite][master]$ python manage.py migrate tnt
/Users/jasonferrier/Sites/transitandtrails/tntsite/tnt/migrations/0019_auto__add_field_userprofile_api_secret__add_field_userprofile_api_key.py:9: SyntaxWarning: import * only allowed at module level
def forwards(self, orm):
Running migrations for tnt:
- Migrating forwards to 0052_auto__del_field_campground_bathrooms__del_field_campground_county__del.
> tnt:0001_initial
FATAL ERROR - The following SQL query failed: SELECT AddGeometryColumn('tnt_trailhead', 'location', 4326, 'POINT', 2);
The error was: permission denied for relation spatial_ref_sys
CONTEXT: SQL statement "SELECT SRID FROM spatial_ref_sys WHERE SRID = new_srid"
PL/pgSQL function "addgeometrycolumn" line 75 at SQL statement
jlfMBP:tntsite postgres$ python manage.py migrate tnt
Running migrations for tnt:
- Migrating forwards to 0052_auto__del_field_campground_bathrooms__del_field_campground_county__del.
> tnt:0019_auto__add_field_userprofile_api_secret__add_field_userprofile_api_key
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 382, in execute
jlfMBP:tntsite postgres$ python manage.py migrate tnt
Running migrations for tnt:
- Migrating forwards to 0052_auto__del_field_campground_bathrooms__del_field_campground_county__del.
> tnt:0001_initial
> tnt:0002_auto__add_transitrouter__add_transitagency
> tnt:0003_auto__add_field_trip_geom
> tnt:0004_auto__add_field_park_slug
> tnt:0005_auto__add_field_park_geom
> tnt:0006_auto__add_cpadparks
> tnt:0007_auto__add_cpadunits
@jasonferrier
jasonferrier / gist:2648015
Created May 9, 2012 19:00
migration issues
jlfMBP:tntsite postgres$ python manage.py migrate tnt
/Users/jasonferrier/Sites/transitandtrails/tntsite/tnt/migrations/0019_auto__add_field_userprofile_api_secret__add_field_userprofile_api_key.py:9: SyntaxWarning: import * only allowed at module level
def forwards(self, orm):
Running migrations for tnt:
- Migrating forwards to 0052_auto__del_field_campground_bathrooms__del_field_campground_county__del.
> tnt:0001_initial
> tnt:0002_auto__add_transitrouter__add_transitagency
> tnt:0003_auto__add_field_trip_geom
> tnt:0004_auto__add_field_park_slug
> tnt:0005_auto__add_field_park_geom
@jasonferrier
jasonferrier / gist:2648156
Created May 9, 2012 19:19
after manually creating api_* columns
jlfMBP:tntsite postgres$ python manage.py migrate tnt
/Users/jasonferrier/Sites/transitandtrails/tntsite/tnt/migrations/0019_auto__add_field_userprofile_api_secret__add_field_userprofile_api_key.py:9: SyntaxWarning: import * only allowed at module level
def forwards(self, orm):
Running migrations for tnt:
- Migrating forwards to 0052_auto__del_field_campground_bathrooms__del_field_campground_county__del.
> tnt:0019_auto__add_field_userprofile_api_secret__add_field_userprofile_api_key
FATAL ERROR - The following SQL query failed: ALTER TABLE "tnt_userprofile" ADD COLUMN "api_secret" text NULL DEFAULT '49c5830c61fbd6dc288f045b172648ae5094d0455c5fdfe59b20c1d6a5e70f27';
The error was: column "api_secret" of relation "tnt_userprofile" already exists
! Error found during real run of migration! Aborting.
@jasonferrier
jasonferrier / functions.php
Created July 19, 2012 22:01
Wordpress - disable plugins on local/preview environments
<?php
// Turn of subscribe2 for local
switch ($_SERVER['HTTP_HOST'])
{
case 'domain.com.dev':
case 'domain.flickerbox.com':
case 'domain.' . $local_network[1] . '.flickerbox.local':
case (bool) preg_match("/^(stage\.)?domain\.([a-z]+)\.flickerbox\.local/i", $_SERVER['HTTP_HOST']):
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
deactivate_plugins('subscribe2/subscribe2.php');
@jasonferrier
jasonferrier / wp-config.php
Last active October 10, 2015 03:27
Wordpress auto-config for dev/test/live environments
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
/*
Copyright Alex Leone, David Nufer, David Truong, 2011-03-11. kathack.com
javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0);
*/
var BORDER_STYLE = "1px solid #bbb",
CSS_TRANSFORM = null,
CSS_TRANSFORM_ORIGIN = null,
POSSIBLE_TRANSFORM_PREFIXES = ['-webkit-', '-moz-', '-o-', '-ms-', ''],
@jasonferrier
jasonferrier / gitStatus.sh
Last active August 29, 2015 14:18
This bash script will inform you any changes in subdirectories that are git repositories
#!/bin/bash
# This bash script will inform you any changes in subdirectories that are git repositories
# todo: trim "/.git" from the output of line 13
for dir in ~/Projects/*/.git
do (
cd $dir/..