Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import sys | |
from suds import client | |
from suds.wsse import Security, UsernameToken | |
from suds.sax.text import Raw | |
from suds.sudsobject import asdict | |
from suds import WebFault | |
''' | |
Given a Workday Employee_ID, returns the last name of that employee. |
1033edge.com | |
11mail.com | |
123.com | |
123box.net | |
123india.com | |
123mail.cl | |
123qwe.co.uk | |
126.com | |
150ml.com | |
15meg4free.com |
using System; | |
using System.Text; | |
using System.Security.Cryptography; | |
static class Hash | |
{ | |
public static string SHA1(string text) | |
{ | |
byte[] buffer = Encoding.UTF8.GetBytes(text); | |
var sha1 = new SHA1CryptoServiceProvider(); |
# Run this in the project repo from the command-line | |
# http://stackoverflow.com/a/4593065/99923 | |
git log --shortstat --author "Xeoncross" --since "2 weeks ago" --until "1 week ago" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}' |
jQuery(function($) { | |
$('form[data-async]').live('submit', function(event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
<?php | |
/** | |
* @name Mutlidimensional Array Sorter. | |
* @author Tufan Barış YILDIRIM | |
* @link http://www.tufanbarisyildirim.com | |
* @github http://github.com/tufanbarisyildirim | |
* | |
* This function can be used for sorting a multidimensional array by sql like order by clause | |
* | |
* @param mixed $array |
def attach_foreignkey(objects, field, select_related=None): | |
""" | |
Shortcut method which handles a pythonic LEFT OUTER JOIN. | |
``attach_foreignkey(posts, Post.thread)`` | |
""" | |
field = field.field | |
qs = field.rel.to.objects.filter(pk__in=distinct(getattr(o, field.column) for o in objects)) | |
if select_related: | |
qs = qs.select_related(*select_related) |
class QuerySetDoubleIteration(Exception): | |
"A QuerySet was iterated over twice, you probably want to list() it." | |
pass | |
# "Skinny" here means we use iterator by default, rather than | |
# ballooning in memory. | |
class SkinnyManager(Manager): | |
def get_query_set(self): | |
return SkinnyQuerySet(self.model, using=self._db) |
<?php | |
/* | |
SQLyog | |
Copyright 2003-2006, Webyog | |
http://www.webyog.com | |
HTTP Tunneling Page | |
This page exposes the MySQL API as a set of web-services which is consumed by SQLyog - the most popular GUI to MySQL. |