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
// Before | |
<script type="text/javascript"> | |
function recent_tweets(data) { | |
for (i=0; i<data.length; i++) { | |
document.getElementById("tweets").innerHTML = | |
document.getElementById("tweets").innerHTML + | |
'<a href="http://twitter.com/{TwitterUsername}/status/' + | |
data[i].id + '"><div class="content">' + data[i].text + | |
'</div></a>'; |
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 envato_marketplace { | |
public static $base_url = 'http://marketplace.envato.com/api/edge/'; | |
public function curl($path) { | |
$ch = curl_init(self::$base_url . $path); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$data = curl_exec($ch); |
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 | |
require 'Envato_marketplaces.php'; | |
$Envato = new Envato_marketplaces(); | |
$c = $Envato->collection(877517); // replace with collection id (see url on collection page) | |
foreach($c as $item) : ?> | |
<li> | |
<a href="<?php echo $item->url . '?ref=yourUsername';?>"> | |
<?php echo $item->item; ?> |
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 assumes that you've installed and are familiar with Slim: http://slim-lang.com/ | |
# Open ~/.bash_profile (if you're a Mac user), and add the following function. | |
function slimtohtml() { | |
slimrb -p $@.slim > $@.html | |
} | |
# Save it, restart Terminal (or: source ~/.bash_profile), and convert. | |
# The following line will look for a file called test.slim in the root of your directory, convert it, and save as test.html | |
slimtohtml test |
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 | |
$someVar = 'some value'; | |
add_action('admin_init', function() { | |
# I want access to $someVar in here, and don't want it to be a global. | |
# Is there a way to pass $someVar into the callback as a local variable? | |
}); |
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 | |
# Instead of | |
$name = 'Jeff'; | |
switch ($name) { | |
case 'Jeff': | |
echo "I'm Jeff"; | |
break; | |
case 'Joe': |
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
// Bad | |
$('a').click(function() { | |
$(this).hide(); | |
$(this).css('color', 'red'); | |
$(this).show(); | |
alert('something else'); | |
$(this).hide(); |
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 global $query_string; ?> | |
<?php query_posts($query_string . '&post_type=screenshot'); ?> |
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 | |
#functions.php | |
function chrisypoo_add_custom_types( $query ) { | |
if( is_category() && empty( $query->query_vars['suppress_filters'] ) ) { | |
$query->set( 'post_type', array( | |
'post', 'screenshot' | |
)); |
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 lt IE 7 ]> | |
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script> | |
<script>CFInstall.check();</script> | |
<![endif]--> |
OlderNewer