Skip to content

Instantly share code, notes, and snippets.

View azharisubroto's full-sized avatar
😁
santuy

Azhari Subroto azharisubroto

😁
santuy
View GitHub Profile
@danielbitzer
danielbitzer / file.php
Last active September 14, 2022 11:12
[Refer A Friend] Programatically get a user's referral coupon/link
<?php
$user_id = 1;
$advocate = \AutomateWoo\Referrals\Advocate_Factory::get( $user_id );
// Retrieve or generate a shareable referral coupon (coupon sharing only)
$advocate->get_shareable_coupon();
// Retrieve or generate a shareable referral link (link sharing only)
$advocate->get_shareable_link();
@taufik-nurrohman
taufik-nurrohman / php-html-css-js-minifier.php
Last active October 12, 2024 17:10
PHP Function to Minify HTML, CSS and JavaScript
<?php
// Based on <https://github.com/mecha-cms/x.minify>
namespace x\minify\_ { // start namespace
$n = __NAMESPACE__;
\define($n . "\\token_boolean", '\b(?:true|false)\b');
\define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+');
@jentanbernardus
jentanbernardus / .htaccess
Created January 24, 2014 03:13
.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>
@joyrexus
joyrexus / README.md
Last active November 5, 2024 14:17 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active November 4, 2024 17:16
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;
}