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
OuyaController c = OuyaController.getControllerByPlayer(i); | |
if(c != null) { | |
if(c.getButton(OuyaController.BUTTON_A)) { | |
//Do whatever it is you need to do. | |
//This can be repeated for each button on the controller | |
} | |
float axisY = c.getAxisValue(OuyaController.AXIS_LS_Y); | |
if(axisY > OuyaController.STICK_DEADZONE) { | |
switch(i) { //'i' being the player number if you're looping through the number of players | |
case 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
function the_secure_post_thumbnail($size, $options) { | |
ob_start(); | |
the_post_thumbnail($size, $options); | |
$thumbnail = ob_get_clean(); | |
$secure_thumbnail = make_secure($thumbnail); | |
echo $secure_thumbnail; | |
} | |
function make_secure($url) { | |
$secure_url = $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
def readInts(file): | |
for line in file: | |
for element in line.split(): | |
yield element | |
elements = readInts(file) | |
for element in elements | |
#some code here | |
#next(elements) advanced iterator |
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 os_overwrite_color_swatch($init) { | |
$default_colours = ' | |
"000000", "Black", "993300", "Burnt orange", "333300", "Dark olive", "003300", "Dark green", "003366", "Dark azure", "000080", "Navy Blue", "333399", "Indigo", "333333", "Very dark gray", | |
"800000", "Maroon", "FF6600", "Orange", "808000", "Olive", "008000", "Green", "008080", "Teal", "0000FF", "Blue", "666699", "Grayish blue", "808080", "Gray", | |
"FF0000", "Red", "FF9900", "Amber", "99CC00", "Yellow green", "339966", "Sea green", "33CCCC", "Turquoise", "3366FF", "Royal blue", "800080", "Purple", "999999", "Medium gray", | |
"FF00FF", "Magenta", "FFCC00", "Gold", "FFFF00", "Yellow", "00FF00", "Lime", "00FFFF", "Aqua", "00CCFF", "Sky blue", "993366", "Brown", "C0C0C0", "Silver", | |
"FF99CC", "Pink", "FFCC99", "Peach", "FFFF99", "Light yellow", "CCFFCC", "Pale green", |
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 | |
/* | |
replacing the default "Enter title here" placeholder text in the title input box | |
with something more descriptive can be helpful for custom post types | |
place this code in your theme's functions.php or relevant file | |
source: http://flashingcursor.com/wordpress/change-the-enter-title-here-text-in-wordpress-963 | |
*/ |
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 only_own_attachments($query) { | |
global $current_user; | |
if(is_admin() && !current_user_can('manage_options') && $query->query['post_type']=='attachment') { | |
$query->set('author', $current_user->id); | |
} | |
return; | |
} | |
add_action('pre_get_posts', 'only_own_attachments'); |
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
slider.setOpts = function(opts) { | |
for (var opt in opts) { | |
slider.vars[opt] = opts[opt]; | |
} | |
slider.setup(); | |
} | |
slider.getOpts = function() { | |
return slider.vars; | |
} |
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 ws_get_attachment_image_url($id, $size) { | |
$img = wp_get_attachment_image_src($id, $size); | |
return $img[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
function add_twig_functions_and_filters() { | |
global $ai1ec_front_controller; | |
$loader = $ai1ec_front_controller->return_registry(true)->get('theme.loader'); | |
$twig = $loader->get_twig_instance(false, true); | |
function foo($date) { | |
if(mktime() > strtotime($date->__toString)) { | |
return true; | |
} | |
else return 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
jQuery(document).ready(function($) { | |
//set up google fonts to load asynchronously with a callback on load | |
WebFontConfig = { | |
google: { | |
families:['Lato:400,700,900,400italic,900italic', 'Oswald'] //the fonts you need | |
}, | |
typekit: { | |
id: 'xxxxxx' //supports typekit as well as others | |
}, | |
active: function(familyName, fvd) { //callback when finished |
OlderNewer