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
// ae - takes URL, puts percents in it. | |
void encodeUrl(char *out, int outSize, char *in, int inSize) | |
{ | |
// Terminate our buffer | |
out[0] = '\0'; | |
// Loop the input | |
for (int i = 0; i < inSize; i++) | |
{ | |
// Get a char out of it |
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 | |
# Get the day number | |
day="$(date +'%u')" | |
echo "Starting backup for day ${day}" | |
# Sync all data to S3, excluding git and svn folders | |
/usr/local/bin/aws s3 sync /path/to/folder s3://bucket/folder \ | |
--exclude "*.svn*" --exclude "*.git*" --delete |
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
// By Alan Edwardes - http://alanedwardes.com/contact | |
// Licensed under The GNU General Public License (GPL) | |
// ------------------------------------------------------------- | |
// A simple events wrapper function for adding events that works | |
// cross browser, and allows you to use the first parameter of | |
// the callback function as a reference to the object that the | |
// event was fired from, which replaces IE's lack of support | |
// for the "this" variable. | |
// | |
// Ex. Usage: |
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 | |
/* | |
Plugin Name: WordPress Mint Intergration | |
Description: Adds mint to the site's header (if the user isn't logged in), adds a "Statistics" menu option with Mint in an iframe. | |
Author: Alan Edwardes | |
Author URI: http://alan.edward.es/ | |
Version: 1.0 | |
*/ | |
function add_mint_javascript(){ |
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
SELECT posts.post_title, posts.ID post_id, media.ID media_id | |
FROM $wpdb->posts media | |
JOIN $wpdb->posts posts | |
ON posts.post_content LIKE CONCAT('%', media.guid, '%') | |
WHERE media.post_type = 'attachment' | |
AND posts.post_type = 'post' | |
AND posts.post_status = 'publish' | |
GROUP BY posts.ID | |
ORDER BY media.post_date DESC | |
LIMIT 0, 9 |
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
<form action="/posts/xyz/#comment-form" method="post"> | |
<input type="text" name="email" value="" id="email_field" style="display:none" /> | |
<div> | |
<label for="cname">Name <small>(If it's not real, it better be cool)</small></label> | |
<input name="name" type="text" id="cname" class="text" value=""/> | |
</div> | |
<div> | |
<label for="jerry_the_spider">Email <small>(optional, used for <a target="_blank" href="http://www.gravatar.com/">your avatar</a>)</small></label> | |
<input name="jerry_the_spider" type="text" id="jerry_the_spider" class="text" value=""/> | |
</div> |
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 hexToRGB(hex){ | |
hex = hex.replace('#', ''); | |
return { | |
'r': parseInt(hex.substring(0, 2), 16), | |
'g': parseInt(hex.substring(2, 4), 16), | |
'b': parseInt(hex.substring(4, 6), 16) | |
} | |
} |
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 getXY(x, y, d, a){ | |
return { | |
x: x + d * Math.cos(a), | |
y: y + d * Math.sin(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
length = Math.max(canvas.width, canvas.height); | |
// Make sure the rays are bigger than the canvas | |
midx = canvas.width / 2, midy = canvas.height / 2; | |
// Get the mid point of our canvas | |
var d = 12; | |
// how many rays (or divisions) | |
for(i = 0;i < d;i++){ | |
angle = (Math.PI * 2 / d) * i; |
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 | |
function iTunesGenreMap($code) | |
{ | |
// iTunes Genre ID to string map | |
// Compiled from this page: http://code.google.com/p/php-reader/wiki/ISO14496 | |
$code = ltrim($code, 0); | |
switch($code) | |
{ | |
case 1: | |
return 'Blues'; |
OlderNewer