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
# utility function | |
def cast_to_strings(varlist): | |
"""Cast all values in a list to string""" | |
new_list = [] | |
for v in varlist: | |
if type(v) in (int, long): | |
new_list.append(str(v)) | |
else: | |
new_list.append(v) | |
return new_list |
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 any($arr, $filter=NULL) { | |
$filtered = isset($filter) ? array_filter($arr, $filter) : array_filter($arr); | |
return sizeof($filtered) > 0 ? TRUE : FALSE; | |
} | |
function all($arr, $filter=NULL) { | |
$filtered = isset($filter) ? array_filter($arr, $filter) : array_filter($arr); | |
return sizeof($filtered) == sizeof($arr) ? TRUE : FALSE; | |
} |
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 hipster_logo($atts) { | |
/** | |
* Wordpress shortcode for generating one of those | |
* hipster X logos. Provides defaults for each | |
* position on the X to make sure the logo will | |
* render. | |
* | |
* Arguments: | |
* id - ID of HTML element that is output. | |
* class - Extra class name(s) of HTML element that |