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/bash | |
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
RUN_IN_BACKGROUND=0 | |
MAX_FORKS=1 | |
usage() { | |
cat << EOF | |
usage: $0 options |
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 | |
// from my ApiComponent | |
/** | |
* Flatten Model find data | |
* | |
* Will flatten data from a find or find multi response by moving the specified | |
* className up to the root of the array. Useful for converting find results to | |
* REST responses. | |
* |
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
// Usage: | |
m_SideBarTexture = CreateTexture (CreateColor ("#30433C")); | |
// The goodness: | |
static Color CreateColor (string hexCode, float alpha = 1.0f) | |
{ | |
if (hexCode.Length == 7 && hexCode[0] == '#') | |
{ |
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
sudo port -v install mysql5-server | |
# Don't do any post-install instructions | |
sudo -u _mysql mysql_install_db5 | |
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9) | |
# do this: | |
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5 | |
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5 | |
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql |
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
// populate users with User.find, etc, then inside that callback: | |
var results = []; | |
async.each(users, function(user, cb) { | |
Foo.find({"user._id":user._id}, function(err, result) { | |
// note: return isn't returning anything valuable, it's just a shortcut to leave the function to avoid ugly } else { | |
if (err) return cb(err); | |
if (result === true) { | |
// whatever this is... |
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
// less | |
.gm-style { | |
img { | |
max-width: inherit !important; | |
} | |
} | |
/* css */ | |
.gm-style img { | |
max-width: inherit !important; |
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
/** | |
* This hasn't been unit tested. It also depends on address_component.types[0] | |
* being the primary type of interest i.e. not something like "political"... | |
*/ | |
function convertAddressComponents(addrComponents) { | |
var address = {}; | |
var typeMap = { | |
street_number: "streetNumber", |
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 | |
// in your constructor, etc | |
add_filter('get_previous_post_where', array($this, 'removePreviousPost')); | |
// have not tested this one but maybe? | |
add_filter('get_next_post_where', array($this, 'removePreviousPost')); | |
// kill with impossible sql | |
// @see https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/link-template.php#L1173 | |
public function removePreviousPost($where) { |
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 | |
$data = array( | |
'namespace' => array( | |
'foo' => array( | |
'bar' => 'You found me!' | |
) | |
) | |
); |
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
var objectToQueryString = function (a) { | |
var prefix, s, add, name, r20, output; | |
s = []; | |
r20 = /%20/g; | |
add = function (key, value) { | |
// If value is a function, invoke it and return its value | |
value = ( typeof value == 'function' ) ? value() : ( value == null ? "" : value ); | |
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); | |
}; | |
if (a instanceof Array) { |
OlderNewer