Moving from jQuery
Events
// jQuery
$(document).ready(function() {
// code
})
<?php | |
echo true ? 'car' : true ? 'horse' : 'feet'; #horse | |
echo true ? 'car' : false ? 'horse' : 'feet'; #horse | |
echo false ? 'car' : false ? 'horse' : 'feet'; #feet | |
echo false ? 'car' : true ? 'horse' : 'feet'; #horse | |
echo false ? 'car' : null ? 'horse' : 'feet'; #feet | |
echo true ? 'car' : null ? 'horse' : 'feet'; #horse | |
echo null ? 'car' : null ? 'horse' : 'feet'; #feet | |
echo null ? 'car' : false ? 'horse' : 'feet'; #feet | |
echo null ? 'car' : true ? 'horse' : 'feet'; #horse |
<?php | |
function getLocation( $y0, $x0, $rad ) { | |
$rad = $rad / 111195.0; | |
echo '$rad: '.$rad."\n"; | |
$u = (float)mt_rand() / (float)getrandmax(); | |
$v = (float)mt_rand() / (float)getrandmax(); | |
echo 'rand: '.$v.' '.$u."\n"; | |
<?php | |
function clearCookies($cookiejar = 'cookies') { | |
@unlink($cookiejar); | |
} | |
function POSTURL( | |
$url, | |
$referer = "", | |
$data = array(), |
location / { | |
if ($uri ~* ^/([^.\?/]+)) { | |
set $foldername "$1"; | |
} | |
sub_filter "<head>" "<head><base href=\"${scheme}://${host}/${foldername}/\">"; | |
} |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Who Am I?</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script> |
// http://jsfiddle.net/96q4m/17/ - old | |
// simulating GET variables | |
if(window.location.search.indexOf('test') < 0) window.location.search = window.location.search+'?test=123&img=https%3A%2F%2Fdrupal.org%2Ffiles%2Ftest-all-the-things.jpg'; | |
// remove everything above this line - stop removing after | |
// closure compiled: | |
$(function(){function a(a){return decodeURIComponent(a.replace(b," "))}for(var b=/\+/g,c=/([^&=]+)=?([^&]*)/g,d=window.location.search.substring(1);y=c.exec(d);)$("#tpl-"+a(y[1])).length&&("IMG"!==$("#tpl-"+a(y[1]))[0].tagName?$("#tpl-"+a(y[1])).html(a(y[2])):$("#tpl-"+a(y[1])).attr("src",a(y[2])))}); |
<?php namespace Common; | |
use \Illuminate\Html\FormBuilder; | |
class FormBuild extends FormBuilder { | |
protected function getRouteAction( $options ) { | |
if( is_array( $options ) ) { | |
return $this->url->route( $options[0], array_slice( $options, 1 ), 0 ); | |
} | |
return $this->url->route( $options, [], 0 ); |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ index.php [QSA,L] |
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
// jQuery
$(document).ready(function() {
// code
})