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
<!--- establish parameters ---> | |
<CFSET username = "bob" /> | |
<CFSET public_key = "FT39JK3F" /> | |
<CFSET private_key = "fj39dfjki302kjdf99j3lkdf902j389a" /> | |
<!--- epoch expressed in seconds ---> | |
<CFSET timestamp = round( (now().getTime()+getTimeZoneInfo().utcTotalOffset) / 1000) /> | |
<CFSET to_hash = username & public_key & private_key & timestamp /> | |
<!--- md5 hashsum of username and keys ---> | |
<CFSET hashsum = lcase(hash(to_hash)) /> | |
<!--- SSO 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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js"></script> | |
</head> | |
<body onload="console.log(this);"> | |
<script> | |
// make sure our scripting is isolated | |
(function() { | |
// copy reference to existing onload event handler |
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
// make sure our scripting is isolated | |
(function() { | |
// copy reference to existing onload event handler | |
var onload = window.onload; | |
// create our own onload event handler | |
window.onload = function() { | |
// call the other onload event | |
if (typeof onload == 'function') { | |
onload(); | |
} |
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
<!-- how to pull JSON from another domain and use it to generate HTML --> | |
<div id="container"></div> | |
<script> | |
$.ajax({ | |
// path to the JSON file | |
url: 'http://yourdomain.com/data.json', | |
// use JSONP to get around cross-domain restrictions, see: http://api.jquery.com/jQuery.ajax/ | |
dataType: 'jsonp', | |
// upon download | |
success: function(data) { |
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 sort_by_event_date($post1, $post2) { | |
$date1 = strtotime(get_post_meta($post1->ID, 'event-date', true)); | |
$date2 = strtotime(get_post_meta($post2->ID, 'event-date', true)); | |
// I've reversed this now so that it sorts in descending order, newest first: | |
return ($date1 == $date2) ? 0 : ($date1 > $date2 ? -1 : 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 | |
$posts = get_posts(array('category_name' => 'events', 'numberposts' => 8)); | |
usort($posts, 'sort_by_event_date'); | |
foreach($posts as $post) { | |
$event_date = strtotime(get_post_meta($post->ID, 'event-date', true)); | |
$M = date('M', $event_date); | |
$d = date('d', $event_date); | |
$Y = date('Y', $event_date); | |
setup_postdata($post); |
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 | |
public function calcLevel($new_pts, $old_pts) { | |
$cur_pts = Member::getPoints($this->member_id, $old_pts); | |
if (!is_numeric($cur_pts)) { | |
$cur_pts = 0; | |
// sometimes we use $cur_pts = is_numeric($cur_pts) ? $cur_pts : 0; | |
} | |
if ($new_lev->level_id > $cur_lev) { | |
$this->new_lev = $new_lev->level_id; |
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(T, api) { | |
function log() { | |
if (window.console) { | |
window.console.log.apply(null, Array.prototype.slice.call(arguments)); | |
} else { | |
api.prototype.log.apply(null, Array.prototype.slice.call(arguments)); | |
} | |
} | |
T.UI.getMainWindow().showInspector(true); |
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 | |
$keyword = ''; | |
$username = ''; | |
$password = ''; | |
$ch = curl_init("http://stream.twitter.com/1/statuses/filter.json?track={$keyword}"); | |
curl_setopt_array($ch, array( | |
CURLOPT_READFUNCTION => 'read_twitter_stream', | |
CURLOPT_USERPWD => '{$username}:{$password}', | |
CURLOPT_TIMEOUT => 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
<?php | |
// in functions.php | |
show_admin_bar(!is_admin() && current_user_can('edit_posts')); |