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
# Shows all the possibilities of a set of coins throwing | |
# You could as well change "heads" and "tails" for true and false. | |
def possibilities(a) | |
results = [] | |
if(a==1) | |
results << ["heads"] | |
results << ["tails"] | |
else |
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
package gaming.online.java; | |
public class Ability { | |
private final double mean; | |
private final double variance; | |
private Ability(final double mean, final double variance) { | |
this.mean = mean; | |
this.variance = variance; | |
} |
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
/* vim: set ft=javascript: */ | |
// http://dean.edwards.name/weblog/2009/12/getelementsbytagname/ | |
function getElementsByTagName(node, tagName) { | |
var elements = [], i = 0, anyTag = tagName === "*", next = node.firstChild; | |
while ((node = next)) { | |
if (anyTag ? node.nodeType === 1 : node.nodeName === tagName) elements[i++] = node; | |
next = node.firstChild || node.nextSibling; | |
while (!next && (node = node.parentNode)) next = node.nextSibling; | |
} | |
return elements; |
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
class Person: | |
def work(self): | |
print "i am working" | |
def eat(self): | |
print "i am eating" | |
def sleep(self): | |
print "i am sleeping" |
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 Shuffle(arr){ | |
var len = arr.length; | |
for(var i = 0;i<len;i++){ | |
var rand = Math.floor(Math.random()*len); | |
var randVal = arr[rand]; | |
var temp = arr[i]; | |
arr[i] = randVal; | |
arr[rand] = temp; | |
} | |
return arr; |
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
if (typeof _gaq !== "undefined" && _gaq !== null) { | |
$(document).ajaxSend(function(event, xhr, settings){ | |
_gaq.push(['_trackPageview', settings.url]); | |
}); | |
} |
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 alter_the_query( $request ) { | |
$dummy_query = new WP_Query(); // the query isn't run if we don't pass any query vars | |
$dummy_query->parse_query( $request ); | |
// @TODO sometimes this will help reduce queries, but sometimes won't | |
$args = array( | |
'showposts' => 1, | |
'update_post_term_cache' => 0, | |
'update_post_meta_cache' => 0, | |
'no_found_rows' => 1 // if showposts = -1, useless |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<!-- Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN. --> | |
<link rel="dns-prefetch" href="//ajax.googleapis.com" /> | |
<link rel="dns-prefetch" href="//s3.amazonaws.com" /> | |
<!-- Make sure the latest version of IE is used --> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
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 | |
/** | |
* Class for managing overlapping helper plugins. This ensures that we use the latest versions of common code. | |
* | |
* Usage: include this file on any plugin that may have shared code BEFORE the 'plugins_loaded' action is completed. | |
* After including this file, register the helper files using the TribeCommonLibraries::register() instead of including the files directly. | |
* | |
* @author Peter Chester | |
* @version 1.0 | |
*/ |