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 url_str = 'http://www.google.com/ig/api?weather=Berlin+Germany&hl=de'; | |
requestCrossDomain(url_str, function(json) { | |
// check the real output at YQL console | |
// http://goo.gl/Z9XHu | |
console.log(json.xml_api_reply.weather) | |
}); | |
// Accepts a url and a callback function to run. | |
// returns jsonp |
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
$('a[data-toggle="tab"]').on('show', function (e) { | |
var $target = $(e.target.hash); | |
var h = e.target.hash.indexOf('map-'); | |
if(h != -1 ){ | |
var loc = $target.parents('.tab-content').find('address').data('address'); | |
var id = $target.find('.google-maps').attr('id'); | |
/* set the active class here, because the map init doesn't wait for the .fade.in | |
css trasition from bootstrap | |
*/ |
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
// redirect if sef does not exists | |
// around line 226 | |
if (!isset(self::$sefs[$sef])) | |
{ | |
// Use the current language sef or the default one | |
$sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]->sef : self::$default_sef; | |
$uri->setPath($sef . '/' . $path); | |
if ($app->getCfg('sef_rewrite')) { | |
// append true for 301 redirect |
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 | |
class EasyWsdl2PHP | |
{ | |
static public function generate($url,$sname) | |
{ | |
$soapClient = new SoapClient($url); | |
$classesArr = array(); | |
$functions = $soapClient->__getFunctions(); |
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
<div class="container"><h3>.row-flex (make columns equal heights in each row)</h3></div> | |
<div class="container"> | |
<div class="row row-flex row-flex-wrap"> | |
<div class="col-md-3"> | |
<div class="panel panel-default flex-col"> | |
<div class="panel-heading">Title flex-col</div> | |
<div class="panel-body flex-grow">Content here -- div with .flex-grow</div> | |
<div class="panel-footer">Footer</div> | |
</div> | |
</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
<?php | |
// jsperf.com like script to benchmark php functions. | |
// http://baylorrae.com/blog/2012/01/09/benchmarking-php-script-speeds/ | |
// a place to store the result of each test | |
$results = array(); | |
// my version of un-camel casing a word | |
function test_1() { | |
return strtolower(implode(' ', preg_split('/(?<=\\w)([A-Z])/', 'aCamelCasedWord'))); |
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 | |
// new date/time object | |
$date = new DateTime('now'); | |
// set order time to a Saturday, 2 pm | |
$date->modify('next sat 14:00'); | |
// orders are taken in till 15 minutes before 2pm | |
// http://php.net/manual/de/datetime.formats.relative.php | |
$order_till = new DateTime('front of 14'); |
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
// http://stackoverflow.com/a/9769532/814031 | |
$('*').filter(function(){ | |
var position = $(this).css('position'); | |
return position === 'absolute'; | |
}); | |
// or extend jquery selector engine | |
// http://stackoverflow.com/a/9770766/814031 | |
$.extend($.expr[':'],{ | |
absolute: function(el) { |
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 | |
class Holidays | |
{ | |
public static function getEaster() | |
{ | |
$easter = new DateTime('now'); | |
$year = $easter->format('Y'); | |
$easter->setDate($year, 3, 21); | |
$easter->setTime(0, 0, 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
/** | |
* Replace middle of the string with given char, keeping length | |
* http://mamchenkov.net/wordpress/2011/05/17/partial-string-replacement-with-fixed-length-in-php/ | |
* | |
* <code> | |
* print padString('1234567890123456', 1, 4, 'x'); | |
* </code> | |
* | |
* @param string $string String to process | |
* @param integer $start Characters to skip from start |
OlderNewer