Skip to content

Instantly share code, notes, and snippets.

View damilare's full-sized avatar
🎯
Focusing

Damilare Onajole damilare

🎯
Focusing
View GitHub Profile
@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 / cleanup.py
Last active April 3, 2020 00:17
Tweeting is like real world conversations. People don't usually record what they say, so it might be a good idea to clean-up your tweets every now and then.
""" 1) Download python twitter library from https://github.com/sixohsix/twitter
2) Go to dev.twitter.com creaate an application and genenrate tokens
3) Setup your tokens below
4) python cleanup.py and your tweets are gone!
"""
from twitter import *
t = Twitter(
auth=OAuth('--your-access-token-here',
@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 ''
"""
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

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!