Skip to content

Instantly share code, notes, and snippets.

View azharisubroto's full-sized avatar
😁
santuy

Azhari Subroto azharisubroto

😁
santuy
View GitHub Profile
@azharisubroto
azharisubroto / grabfile.php
Created August 3, 2016 10:51
This code snippet is useful to copy a large file from other server and store it to your server.
<?php
set_time_limit(0);
//This is the file where we save the information
$fp = fopen (dirname(__FILE__) . '/filename.rar', 'w+');
//Here is the file we are downloading, replace spaces with %20
$ch = curl_init(str_replace(" ","%20", 'http://someserver.crot/filename.rar'));
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
@azharisubroto
azharisubroto / SimplePhpFlickr.php
Created February 1, 2016 16:23
The final result from hours of googling, finally I can find this snippet.
<?php
// Read more API Documentation @ https://www.flickr.com/services/api/
$xml = simplexml_load_file("https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id={YOUR USER ID}&per_page=[NUMBER OF PHOTOS TO FETCH]&api_key={REQUIRED!!! YOUR API KEY}&&format=rest");
$output = "<div>";
foreach($xml->children()->children() as $child) {
$imgsrc = "http://farm" . $child['farm'] . ".static.flickr.com/" . $child['server']. "/" . $child['id'] . "_" . $child['secret'] . "_s.jpg"; // More about image size suffixes: https://www.flickr.com/services/api/misc.urls.html
$fullsize = "http://farm" . $child['farm'] . ".static.flickr.com/" . $child['server']. "/" . $child['id'] . "_" . $child['secret'] . "_o.(jpg|gif|png)";
$output .= "<a href='".$imgsrc."'>";
$output .= "<img src='".$imgsrc."' />";
$output .= "</a>";
@azharisubroto
azharisubroto / php-html-css-js-minifier.php
Created January 28, 2016 15:50 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
<?php
/**
* Register widget areas.
*/
function _action_theme_widgets_init() {
if( function_exists('fw_get_db_settings_option') ){
$sections = fw_get_db_settings_option('footer_section');
if(!empty($sections)){
foreach ($sections as $section) {
$footer_widgets = $section['footer_widgets'];
<?php
/**
* Slideshow shortcode usage: [gallery type="slideshow"] or the older [slideshow]
*/
if(!class_exists('zl_add_jetPack_slideshow')){
class zl_add_jetPack_slideshow {
public $instance_count = 0;
function __construct() {