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 / wp-move-scripts-to-footer.md
Created June 18, 2020 08:38 — forked from japalekhin/wp-move-scripts-to-footer.md
Move all scripts to footer in WordPress
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title> Failed to check for key existence (500 Internal Server Error)
</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAYAAAABtRhCAAADVUlEQVRIx82XX0jTURTHLYPyqZdefQx66CEo80+aYpoIkqzUikz6Z5klQoWUWYRIJYEUGpQ+lIr9U5dOTLdCtkmWZis3rbnC5fw/neYW002307mX/cZvP3/7o1PwwOdh95x7vnf39zvnd29AgBer2xO6DclAXiMqZAqxIiNIN/IYSUS2BPhjmGATchUxI+ADWiRhpWK7HKuHFVBFdmU5YvnI4grFGCaReF/EBH4KsZlGgj2JBTuCYBWRIYF8YoEOJ6wBt/gEs7mBbyOjQXruPLSdOgPCiEiPSUUHDoL8Ug5IUo9B/d5wrt+G7OAKNrODPuVdB6vRCIzN6SdBlpW9RIgk/1FeAXabzRlrUPVCS/JhbmwudztnGeeH9AyXBIwtmM3wLinZJZHifjHw2V+NBoRh+9ixQrbgbnaSIcl7cGea6hoXQbNe7za241oeO5Z0p42M4BV2EqP2D50wo+6HzvwC6C4sApNOR8cmOrtcnhtj2kYRyC9eBvXzKrBZrXSs72kFd1t3MoKVbMekQkEnSNKOO8fac3LpmK6l1TlGtsxmsdKFsecPYgwxst0cwROMYDXboSotg0WLBRqjY51jLYcENElXwW2XJKPyd
@azharisubroto
azharisubroto / .htaccess
Created June 10, 2018 16:41 — forked from jentanbernardus/.htaccess
.htaccess Rules for Better Google Page Speed Results - Here's a set of default rules that I add to any site that I want to significantly increase the speed of. It took a lot of weeding through and testing, but this seems to work the best and will (guarantee not included) increase your Google Page Speed score by taking care of a lot of the cache …
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
/*
* Name: Color Scroll
* Author: Amir R Muntasser
* Description: Change background color CSS property of body as you scroll.
* Dependencies: jQuery 1.4.2+
* License: MIT License
*/
var colors = $("#colorScroll").data("colors");
var colors_array = colors.split(":");
@azharisubroto
azharisubroto / gist:954dea70f065d3db287c9aa6f7505aa6
Created December 22, 2016 12:27
Sticky sidebar "jump" problem
// Sticky article aside
$(window).on('load', function(){
$('#sidebar').stick_in_parent({
offset_top: 72,
parent: '#main',
spacer: false
});
});
$('#sidebar').on('sticky_kit:bottom', function(e) {
$(this).parent().css('position', 'static');
@azharisubroto
azharisubroto / functions.php
Created September 13, 2016 10:53 — forked from anonymous/functions.php
Query Args
<?php
function themeslug_query_vars( $qvars ) {
$vars[] = 'headertype';
return $vars;
}
add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 );
@azharisubroto
azharisubroto / fancynumber.php
Created September 8, 2016 09:23
fancy number
<?php
function zl_fancy_number($n, $precision = 1) {
if ($n < 1000) {
// Anything less than a thousand
$n_format = number_format($n);
} elseif ($n > 1000 && $n < 10000) {
$n_format = number_format($n / 1000, $precision) . 'K';
} elseif ($n < 1000000000) {
// Anything less than a billion
$n_format = number_format($n / 1000000, $precision) . 'M';
@azharisubroto
azharisubroto / php simple unzip
Created September 4, 2016 17:31
Thanks to rdlowrey at stackoverflow. http://stackoverflow.com/a/8889126
<?php
// assuming file.zip is in the same directory as the executing script.
$file = 'file.zip';
// get the absolute path to $file
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
@azharisubroto
azharisubroto / wp-instagram.php
Last active August 5, 2016 09:37
easy instagram scraper.
<?php
$instagramusername = 'azhari.subroto';
$args = array(
'timeout' => 360,
'httpversion' => '1.1'
);
$response = wp_remote_get('http://instagram.com/'.$instagramusername, $args);
// Check for error
if ( is_wp_error( $response ) ) {
@azharisubroto
azharisubroto / instagram_scrape.php
Created August 4, 2016 14:54 — forked from cosmocatalano/instagram_scrape.php
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}