Skip to content

Instantly share code, notes, and snippets.

@ahmedghazi
ahmedghazi / pdf embed shortcode
Created May 6, 2013 13:20
pdf embed shortcode
function pdf_function($attr, $url) {
extract(shortcode_atts(array(
'width' => '640',
'height' => '480'
), $attr));
return '<iframe src="http://docs.google.com/viewer?url=' . $url . '&embedded=true" style="width:' .$width. '; height:' .$height. ';">Your browser does not support iframes</iframe>';
}
add_shortcode('pdf', 'pdf_function');
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open mobile safari
echo Open mobile safari on emulator and press return
read
# Plug debug to MobileSafari.app
@ahmedghazi
ahmedghazi / gist:6267608
Created August 19, 2013 10:02
PHP stdClass: Storing Data in an Object Instead of an Array
$book = new stdClass;
$book->title = "Harry Potter and the Prisoner of Azkaban";
$book->author = "J. K. Rowling";
$book->publisher = "Arthur A. Levine Books";
$book->amazon_link = "http://www.amazon.com/dp/0439136369/";
$array = array(
"title" => "Harry Potter and the Prisoner of Azkaban",
"author" => "J. K. Rowling",
.parent { display: -ms-flex; display: -webkit-flex; display: flex; }
.parent>div { flex:1; }
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
.close {
position: absolute;
right: 32px;
top: 32px;
width: 32px;
height: 32px;
opacity: 0.3;
}
.close:hover {
opacity: 1;
ls -t | sed -e '1,10d' | xargs -d '\n' rm
var url = "https://www.facebook.com/sharer/sharer.php";
url += '?u='+window.location.href;
url += '&picture='+picture;
url += '&description='+caption;
$body = array(
array(
'offerIdTarifs' => "FPP-CLASSIC",
'pickupName' => get_bloginfo("name"),
'pickupLatitude' => PICKUPLAT,
'pickupLongitude' => PICKUPLNG,
'pickupAddress' => PICKUPADRESSE,
'pickupAddress2' => "",
'pickupTel' => PICKUPTEL,
'pickupZip' => PICKUPZIP,
var datas = [{
'offerIdTarifs': pickup.offerIdTarifs,
'pickupName': pickup.pickupName,
'pickupLatitude': pickup.pickupLatitude,
'pickupLongitude': pickup.pickupLongitude,
'pickupAddress': pickup.pickupAddress,
'pickupAddress2': pickup.pickupAddress2,
'pickupTel': pickup.pickupTel,
'pickupZip': pickup.pickupZip,
'pickupCity': pickup.pickupCity,