I hereby claim:
- I am hasinhayder on github.
- I am hasin (https://keybase.io/hasin) on keybase.
- I have a public key whose fingerprint is 8319 D4D0 29CE 3C50 F788 D033 95EB 88C0 DF4D 79A3
To claim this, I am signing this object:
function number_of_posts_per_day($query){ | |
if (date("l")=="Sunday") { | |
$query->set('posts_per_page', 20); | |
} | |
elseif (date("l")=="Monday") { | |
$query->set('posts_per_page', 10); | |
} | |
elseif (date("l")=="Tuesday") { | |
$query->set('posts_per_page', 5); | |
} |
<?php | |
//file: fetch.php | |
use Twig_Extension; | |
use Twig_Function_Method; | |
class Fetch extends Twig_Extension | |
{ | |
public function fetch ($url, $params=array()) | |
{ | |
if($url){ | |
$ch = curl_init($url); |
<?php | |
class Car{ | |
private $numberPlate; | |
function __construct(){ | |
$this->numberPlate = "G ".mt_rand(1,1000); | |
} | |
function honk(){ | |
echo "Pip Pip. The Numberplate is {$this->numberPlate} \n"; | |
} |
I hereby claim:
To claim this, I am signing this object:
<?php | |
function change_to_cdn_url() { | |
return 'http://your.cdn.url/wp-content/uploads'; | |
} | |
add_filter( 'pre_option_upload_url_path', 'change_to_cdn_url' ); |
for(i=0;i<selected_ids.length;i++){ | |
if(selected_ids[i]>0){ | |
var attachment = new wp.media.model.Attachment.get(selected_ids[i]); | |
attachment.fetch({success:function(att){ | |
container.append("<li><img src='" + att.attributes.sizes.thumbnail.url + "'</li>"); | |
}}); | |
} | |
} |
var attachment_id = 1234; | |
var attachment = new wp.media.model.Attachment.get(attachment_id); | |
attachment.fetch({success:function(att){ | |
if (_.contains(['png','jpg','gif','jpeg'],att.get('subtype'))) { | |
console.log(att.attributes); | |
$("<img/>").attr("src",att.attributes.sizes.thumbnail.url).appendTo($("body")); | |
} | |
}}); |
<?php | |
function tb_get_previous_post_link(){ | |
global $post; | |
$prev_link = ""; | |
$prev_post = get_previous_post(); | |
if($prev_post){ | |
$prev_link = get_the_permalink($prev_post->ID); | |
} | |
return $prev_link; | |
} |
<?php | |
function init_url_rewrite_rule(){ | |
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT ); | |
if(get_option("EDIT_REWRITE_RULE")!=1){ | |
flush_rewrite_rules(); | |
update_option("EDIT_REWRITE_RULE",1); | |
} | |
} | |
function redirect_edit_url(){ |
#!/usr/bin/env php | |
<?php | |
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page | |
set_time_limit(0); | |
$dir = $argv[1]; | |
$source = $argv[2]; | |
print_r($argv); | |
mkdir ($dir); | |
$src = file_get_contents($source); | |
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i'; |