Skip to content

Instantly share code, notes, and snippets.

View aprakasa's full-sized avatar
🎯
Focusing

Arya Prakasa aprakasa

🎯
Focusing
View GitHub Profile
{
"version": 1.1,
"atDirectives": [
{
"name": "@tailwind",
"description": "Use the @tailwind directive to insert Tailwind's `base`, `components`, `utilities`, and `screens` styles into your CSS.\n\n",
"references": [
{
"name": "Tailwind's “Functions & Directives” documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives/#tailwind"
@aprakasa
aprakasa / expire-header.conf
Created December 3, 2018 13:38
Nginx expire headers
location ~* \.(?:css|js|txt)$ {
expires 1M;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
add_header Cache-Control "public";
}
location ~* \.(?:json|xml|rss|atom)$ {
expires 1h;
@aprakasa
aprakasa / .htaccess
Created December 3, 2018 13:18
Essential
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^wp-admin/includes/ - [F,L]
/**
* [http2_server_push description]
* @param [type] $content [description]
* @return [type] [description]
*/
function autoptimize_http2_server_push($content) {
$header = "Link: ";
if ( preg_match('#="([^"]+/js/autoptimize_[0-9a-f]+\.js)"#', $content, $matches ) ) {
$header .= sprintf(
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
<?php
/**
* Encrypt Text
* @link https://shellcreeper.com/?p=2082
*/
function my_encrypt( $plain_text ){
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$h_key = hash('sha256', wp_salt(), TRUE);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $h_key, $plain_text, MCRYPT_MODE_ECB, $iv));
@aprakasa
aprakasa / composer-fix.md
Created April 19, 2018 13:13
Fix Composer slow install for SEA
@aprakasa
aprakasa / eh.conf
Created January 2, 2018 18:08
Nginx Expires Header
location ~* \.(css|js)$ {
expires 365d;
}
location ~* \.(jpe?g|png|gif|ico|ogg|mp4|woff2?|ttf|otf|svg)$ {
expires 30d;
}
<?php
add_action( 'init', 'ap_enable_autoembed_intro' );
/**
* Run shortcodes and enable autoembed at Genesis archive intro text.
*/
function ap_enable_autoembed_intro(){
/** Global $wp_embed */
global $wp_embed;
@aprakasa
aprakasa / gist:5501800
Last active December 16, 2015 21:39
Dequeue Default fontawesome styles from Widget Text Icon plugin
add_action( 'wp_enqueue_scripts', 'wti_dequeue_fontawesome_styles' );
/**
* Dequeue Default fontawesome styles from Widget Text Icon plugin
*
*/
function wti_dequeue_fontawesome_styles() {
if ( class_exists( 'Widget_Text_Icon' ) ) {
wp_dequeue_style( 'fontawesome' );
wp_dequeue_style( 'fontawesome-ie7' );