Skip to content

Instantly share code, notes, and snippets.

View damilare's full-sized avatar
🎯
Focusing

Damilare Onajole damilare

🎯
Focusing
View GitHub Profile

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@damilare
damilare / tree.md
Last active August 29, 2015 14:19 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

packs = None
if hasattr(dmd, 'ZenPackManager'):
packs = dmd.ZenPackManager.packs
else:
packs = dmd.packs
phase2 = False
for pack in packs():
try:
@damilare
damilare / izendmd.py
Last active August 29, 2015 14:21 — forked from cluther/izendmd.py
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2012, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################
'''
@damilare
damilare / gist:717029
Created November 26, 2010 18:08
parse data
<?php
//loop to fetch members
function parse_data($str_to_array, $key = '', $value = '', $output_data = array()){
foreach($str_to_array as $item){
if(!is_numeric($item)){
//check for values
if(!empty($key) && !empty($value)){
$output_data[$key] = $value;
parse_data($str_to_array, '', '', $output_data);
} else {
@damilare
damilare / correct_case.py
Created June 17, 2012 12:04
Case correction service
import re, web, urlparse
def correct_case(text):
return ' '.join(['%s.' % x.strip().capitalize() for x in re.split('\.', text) if x])
urls = (
'/api/correct_case','CaseService'
)
app = web.application(urls, globals())
@damilare
damilare / plugins.py
Created July 22, 2012 09:59
Load Plugin
if settings.TWITTER_INTEGRATION_ENABLED:
js_files.append('components/twitter.js')
if settings.GITHUB_INTEGRATION_ENABLED:
js_files.append('components/github.js')
if settings.DRIBBBLE_INTEGRATION_ENABLED:
js_files.append('components/dribbble.js')
if settings.INSTAGRAM_INTEGRATION_ENABLED:
# The first Django site to run on Python 3!
# Copyright (c) 2012 Aymeric Augustin
# License: https://github.com/django/django/blob/master/LICENSE
import os
import sys
import django
from django.conf.urls.defaults import patterns
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError
@damilare
damilare / esb_solutions.txt
Last active December 10, 2015 22:18
ESB Solutions
h1. The Plan
The plan is to make the next generation of WebCore into something greater -- something beyond the current web frameworks. Something that web functionality is just one part of. A service component framework that facilitates modularity and code reuse.
h1. Sources of Inspiration
Some existing projects can be used as sources of inspiration for the design of this component framework. Those include:
* "Jenkins":http://jenkins-ci.org/ for its web interface and plugin system
* "Mule":http://www.mulesoft.org/ and "Apache ServiceMix":https://servicemix.apache.org/ as the leading open source ESBs in the world
def __unicode__(self):
try:
return '{0}'.format(self.name)
except UnicodeError:
return ''