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
<!-- lf: begin: list agenda event --> | |
<?php | |
query_posts(array('meta_key' => 'agenda_begins', 'orderby' => 'meta_value', 'post_type' => 'event', 'showposts' => 5)); | |
if (have_posts()): | |
?> | |
<section class="agenda"> | |
<h1><?php _e('Upcoming events'); ?></h1> | |
<dl class="eventListings"> | |
<?php while(have_posts()): the_post(); ?> | |
<dt><a class="eventTitle" href="<?php the_permalink() ?>"><?php the_title(); ?></a></dt> |
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 | |
$dir = dirname(__FILE__).'/locale'; | |
$locale="nl_NL"; //"en_GB"; | |
$domain="messages"; | |
echo "dir = {$dir}\n"; | |
echo "locale = {$locale}\n"; | |
echo "domain = {$domain}\n\n"; |
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 | |
/** | |
References : | |
1. http://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements | |
*/ | |
$country_codes = array( | |
'AF' => "AFGHANISTAN" , | |
'AL' => "ALBANIA" , | |
'DZ' => "ALGERIA" , |
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 | |
/** | |
* bypass gettext caching by using a clever file-renaming | |
* mechanism described in http://blog.ghost3k.net/articles/php/11/gettext-caching-in-php | |
*/ | |
static protected function spawnUncachedDomain($locale, $domain) { | |
// path to the .MO file that we should monitor | |
$filename = "locale/{$locale}/LC_MESSAGES/{$domain}.mo"; | |
$mtime = \filemtime($filename); // check its modification time |
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 | |
/** | |
* Lithium: the most rad php framework | |
* | |
* @copyright Copyright 2012, Union of RAD (http://union-of-rad.org) | |
* @license http://opensource.org/licenses/bsd-license.php The BSD License | |
*/ | |
namespace lithium\g11n; |
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
regex: (Text::get) -> replace with: _ | |
regex: (?<=Text::get\(\')(.*)(?=\'\);) returns as match the contents of the id string used as a param, then you look it up in the db and replace it with the actual value. -> lu = lookup(match[0]) /s/match[0]/lu |
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
#!/bin/sh | |
# ---------------------------------------------------------------------- | |
# Extract the bookmark annotations from the Kobo database. | |
# ---------------------------------------------------------------------- | |
kobodir=/media/KOBOeReader | |
db="$kobodir/.kobo/KoboReader.sqlite" | |
sqlite3 "$db" 'select VolumeID,StartContainerPath,Text,Annotation from Bookmark;' | | |
awk -F'|' 'BEGIN{OFS="|"}{gsub("/", "_", $1); print}' | | |
sort -t/ -k1 -k2 -n -k4 -k5 -k6 -k7 -k8 | | |
sed ' s/[^|]*|// s/[^|]*|// s/|/\n\n/ s/$/\n\n/ ' |
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 parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
YELLOW="\[\033[0;33m\]" | |
# Comment in the above and uncomment this below for a color prompt | |
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w$Y$ |
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
int smaxabs(int a, int b) { | |
if((a < 0) && (b < 0)) { | |
return min(a, b); | |
} else if ((a < 0) && ( b > 0)) { | |
return ((abs(a) > b) ? a : b); | |
} else if ((a > 0) && ( b < 0)) { | |
return ((abs(b) > a) ? b : a); | |
} else { | |
return max(a, b); | |
} |
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
double midi2freq(int midi) | |
{ | |
double f; | |
f = exp (log (440.0) + (double)(midi - 69) * log (2.0) / 12.0); | |
return (f); | |
} | |
int freq2midi(double f) | |
{ |
OlderNewer