This file contains 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
<?php | |
/** | |
* Took the components necessary to render views from CController, adding it to a console command | |
*/ | |
class RenderReadyConsoleCommand extends CConsoleCommand | |
{ | |
protected $_widgetStack; | |
public function run($args) { } | |
public function renderPartial($view,$data=null,$return=true) | |
{ |
This file contains 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
$.fn.log = function(options) { | |
this.each(function() { | |
console.log(this); | |
}); | |
return this; | |
} |
This file contains 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
Array.prototype.each = function(callback) { | |
for( i=0; i<this.length; i++ ) { | |
callback(this[i]); | |
} | |
} |
This file contains 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
(function($) { | |
/** | |
* Maximum Character Counter | |
* Author: Ryan Bales, Creative Anvil 2011 | |
* | |
* This plugin allows one to specify a container for a character counter element, set the maximum characters, and add an 'error' class to | |
* counter elements of offending text inputs | |
*/ | |
$.fn.jsCharacterCounter = function(options) { | |
// Set default values |
This file contains 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
function ReverseGeocodeLatLng(latlng) | |
{ | |
var geocoder = new google.maps.Geocoder(); | |
if (latlng !== undefined) { | |
latlng = latlng.split(','); | |
var LatLng = new google.maps.LatLng(latlng[0],latlng[1]); | |
geocoder.geocode({location:LatLng},function(result,status) { | |
if( status == 'success' ) { | |
var locationString = ""; | |
$(result).each(function() { |
This file contains 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
// load an image - with a callback on load | |
function loadImageDynamic(image_url,callback,container) { | |
if( container != 'undefined' ) { | |
container = 'body'; | |
} | |
var image_load = 0; | |
$('<img/>') | |
.attr('src',image_url) | |
.load( function(e) { | |
if( image_load < 1 ) { // webkit hack to protect from multiple loads on cached images |
This file contains 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
$.fn.serializeToObject = function() { | |
var serial_array = this.serializeArray(); | |
var serial_object = {}; | |
$(serial_array).each(function() { | |
if( !serial_object[this.name] ) | |
{ | |
serial_object[this.name] = this.value; | |
} | |
}); | |
return serial_object; |
This file contains 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
<% | |
Action<System.Data.DataTable, int> printCategoriesRecursively = null; | |
printCategoriesRecursively = (System.Data.DataTable categoryRows, int depth) => { | |
if (categoryRows==null || categoryRows.Rows.Count==0) return; | |
%> | |
<ul class="node-list depth-<%=depth%>"> | |
<% | |
foreach (System.Data.DataRow CategoryRow in categoryRows.Rows) { | |
%> | |
<li> |
This file contains 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
public Dictionary<string,Object> getChildrenRecursive() | |
{ | |
Dictionary<string,Object> categoryDictionary = new Dictionary<string, Object>(); | |
Dictionary<string, Object>[] children; | |
if (this.hasChildren()) | |
{ | |
// Get child nodes | |
Duke.CategoryDataTable ChildTable = this.CategoryAdapter.GetAllByParentCategory(categoryCode); | |
children = new Dictionary<string, Object>[ChildTable.Rows.Count]; | |
for (int i = 0; i < ChildTable.Rows.Count; i++) |
This file contains 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 pprint | |
import psycopg2 | |
import psycopg2.extras | |
from psycopg2.extras import DictConnection | |
class pgImport(object): | |
"""Imports data to pg instance""" | |
def __init__(self,dbname='template1',user='postgres',password='postgres',host='localhost'): | |
"""Constructor""" | |
self.db = psycopg2.connect('dbname=%s user=%s host=%s password=%s' % (dbname,user,host,password)) |