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 ajax(url, callback) { | |
var xmlhttp; | |
xmlhttp = new XMLHttpRequest(); | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { callback(xmlhttp.responseText); } | |
} | |
xmlhttp.open("GET", url, true); | |
xmlhttp.send(); | |
} |
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 | |
// http://forrst.com/posts/PHP_Timezone_Conversion_Including_Daylight_Savi-9ah | |
date_default_timezone_set("America/New_York"); | |
function timec($event, $eventtz, $usertz){ | |
//convert event time to gmt | |
$etz = new DateTime(date('Y-m-d'), new DateTimeZone($eventtz)); | |
$etzo = $etz->getOffset(); | |
$gmt = strtotime($event) - $etzo; |
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 name="timezone"> | |
<option value="America/New_York">(-05:00) US/Canada Eastern Time</option> | |
<option value="America/Chicago">(-06:00) US/Canada Central Time</option> | |
<option value="America/Denver">(-07:00) US/Canada Mountain Time</option> | |
<option value="America/Los_Angeles">(-08:00) US/Canada Pacific Time</option> | |
<option value="">-----</option> | |
<option value="Pacific/Wake">(-12:00) International Date Line West</option> | |
<option value="Pacific/Apia">(-11:00) Midway Island</option> | |
<option value="Pacific/Apia">(-11:00) Samoa</option> | |
<option value="Pacific/Honolulu">(-10:00) Hawaii</option> |
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
javascript:(function() { window.open('http://localhost/lazy/uri.php?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'bookmarklet','width=200,height=200'); }); |
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
var typeahead = { | |
timer: false, | |
start: function(input) { | |
_debug(".typeahead keyup"); | |
// Unset any started timers from previous keyup | |
if (typeahead.timer != undefined) { | |
clearTimeout(typeahead.timer); | |
} |
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
// Works well on most current popular browsers. (Web fonts shakey on fringe browsers) | |
.styled-input { | |
input[type=radio] { | |
display: none; | |
&:checked + label:before { | |
@include icon($icon-radio-checked); | |
color: #000; | |
} |
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
<pre> | |
<? | |
class ImageShack { | |
function auth($username, $password) { | |
$this->debug("Logging in"); | |
$response = $this->doCurl("post", "https://api.imageshack.us/v1/user/login", array( | |
"user" => $username, | |
"password" => $password |
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 ytEmbed($str) { | |
$pattern = '/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/i'; | |
$found = preg_match_all($pattern, $str, $matches); | |
if ($found > 0) { | |
foreach ($matches[0] as $k => $replaceThis) { | |
$ytid = $matches[1][$k]; | |
$replaceWith = '<div class="media"><div class="video-container"><iframe title="YouTube video" class="youtube-player" height="315" width="560" type="text/html" src="http://www.youtube.com/embed/'.$ytid.'" frameborder="0"></iframe></div></div>'; | |
$str = str_replace($replaceThis, $replaceWith, $str); | |
} |
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 | |
$bbcode = file_get_contents("bbcode.txt"); | |
function bbcodeToHtml($str, $convertBreaks=true) { | |
$replace = array( | |
// bold | |
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
<style> | |
.arrowme:after { | |
position: absolute; | |
display: inline-block; | |
content: ''; | |
margin-left: 10px; | |
border-top: 6px solid transparent; | |
border-bottom: 6px solid transparent; | |
border-left: 6px solid #000; | |
margin-top: 9px; |