These gists will help through the installation of PHP54, MySQL, and Postgres
This assumes that you have already installed Homebrew (http://mxcl.github.io/homebrew/)
<?php | |
function slugify($text) | |
{ | |
// replace non letter or digits by - | |
$text = preg_replace('~[^\\pL\d]+~u', '-', $text); | |
// trim | |
$text = trim($text, '-'); | |
<?php | |
if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { | |
the_post_thumbnail("loop-image"); | |
}else{ | |
$thumb=get_thumb_url($post->post_content, 'loop-image'); | |
if ($thumb!='') { | |
?> | |
<img src="<?php echo $thumb; ?>" alt="<?php get_the_title(); ?>" /> | |
<?php | |
} |
<?php | |
function fetchData($url){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 20); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
} |
<?php | |
// php -S localhost:8888 routing.php | |
if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) { | |
return false; | |
} else { | |
include __DIR__ . '/index.php'; | |
} |
These gists will help through the installation of PHP54, MySQL, and Postgres
This assumes that you have already installed Homebrew (http://mxcl.github.io/homebrew/)
<?php | |
/* | |
Checks if a string is base65 encoded or not already... | |
*/ | |
function is_base64($str) { | |
if (!preg_match('~[^0-9a-zA-Z+/=]~', $str)) { | |
$check = str_split(base64_decode($str)); | |
$x = 0; | |
foreach ($check as $char) if (ord($char) > 126) $x++; | |
if ($x/count($check)*100 < 30) return true; |
<?php | |
$email = "me@example.com"; | |
// To find your weather feed.... | |
// * Go here: http://forecast.weather.gov/MapClick.php?lat=37.7749295&lon=-122.41941550000001#.UdpHAj7714E | |
// * Search for your location (upper left side of the page as of 7/7/2013) | |
// * Click the orange "XML" button/link (on the right hand side, beneath the first map as of the same date) | |
$feed = 'http://forecast.weather.gov/MapClick.php?lat=39.01000&lon=-96.28&unit=0&lg=english&FcstType=dwml'; |
<script src="//platform.twitter.com/widgets.js"></script> | |
<script> | |
var tweet = { | |
url: "", // url to share | |
via: "", // omit @, twitter username | |
text: "", // tweet text | |
hashtags: "" // omit #, comma seperated "twitter,twitterapi" | |
} | |
var intent_url = 'https://twitter.com/intent/tweet?' + $.param(tweet); | |
$('a#tweet-button').attr('href', intent_url); |
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Say>The conference will begin when the moderator joins</Say> | |
<Dial> | |
<Conference startConferenceOnEnter="false">Room1234</Conference> | |
</Dial> | |
</Response> |
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Dial action="rollcall.php" method="POST" hangupOnStar="true" timeLimit="1800"> | |
<Conference startConferenceOnEnter="true" endConferenceOnExit="false">Room1234</Conference> | |
</Dial> | |
</Response> |