Skip to content

Instantly share code, notes, and snippets.

View tfirdaus's full-sized avatar
👨‍💻

Thoriq Firdaus tfirdaus

👨‍💻
View GitHub Profile
@tfirdaus
tfirdaus / modernizr-tests.js
Last active January 19, 2016 10:41 — forked from danott/modernizr-tests.js
Example of Custom Modernizr Tests
/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/
@tfirdaus
tfirdaus / plugin_deploy.sh
Created February 3, 2016 09:47 — forked from lesterchan/plugin_deploy.sh
WordPress Plugin Deploy From GitHub to SVN
#!/bin/bash
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
#MSG=${1-'Deploying $DIR_NAME from GitHub'}
#BRANCH=${2-'trunk'}
MSG="Deploying $DIR_NAME from GitHub"
BRANCH="trunk"
DEST_DIR=~/svn/wordpress_plugins/$DIR_NAME/$BRANCH
@tfirdaus
tfirdaus / vvv-blueprints.json
Created February 29, 2016 07:36
VV Blueprints
{
"dev-plugin":{
"mu_plugins":[
{
"location":"https://github.com/norcross/airplane-mode.git"
},
{
"location":"https://github.com/explodybits/hookr-plugin/"
}
],
@tfirdaus
tfirdaus / post-format-functions.txt
Last active March 8, 2016 04:34 — forked from DrewAPicture/gist:6141436
List of WordPress Removed Functions Related to Post Formats
http://codex.wordpress.org/Function_Reference/get_attached_audio
http://codex.wordpress.org/Function_Reference/get_attached_video
http://codex.wordpress.org/Function_Reference/get_attached_images
http://codex.wordpress.org/Function_Reference/get_attached_image_srcs
http://codex.wordpress.org/Function_Reference/get_content_media
http://codex.wordpress.org/Function_Reference/get_content_audio
http://codex.wordpress.org/Function_Reference/get_content_video
http://codex.wordpress.org/Function_Reference/get_content_images
http://codex.wordpress.org/Function_Reference/get_content_image
http://codex.wordpress.org/Function_Reference/get_content_galleries
# Upstream to abstract backend connection(s) for php
upstream php {
server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9000;
}
server {
server_name example.com;
root /var/www;
@tfirdaus
tfirdaus / autoload.php
Created October 18, 2016 10:11 — forked from santerref/autoload.php
WordPress autoloader that respects PHP coding standards for plugin.
<?php
spl_autoload_register( function ( $class ) {
// project-specific namespace prefix
$prefix = 'my_plugin\\';
// base directory for the namespace prefix
$base_dir = __DIR__ . '/includes/';
@tfirdaus
tfirdaus / invert.js
Created June 14, 2017 21:45 — forked from sofish/invert.js
invert binary tree
function invert(tree) {
if (!tree instanceof Array || tree.length === 1) return tree;
var ret = [];
var inverted = tree.reverse();
for(var cur in inverted) {
if(!inverted.hasOwnProperty(cur)) continue;
ret.push(inverted[cur] instanceof Array ? invert(inverted[cur]) : inverted[cur]);
}
@tfirdaus
tfirdaus / docker-useful-commands.md
Last active December 30, 2017 12:35 — forked from ngpestelos/remove-docker-containers.md
A collection of handy Docker CLI

Delete all containers

docker ps -q -a | xargs docker rm

-q prints only the container IDs -a prints all containers

@tfirdaus
tfirdaus / wp-mysql-optimizations.sql
Last active October 26, 2018 11:06 — forked from boogah/wp_mysql_optimizations.sql
Common database optimizations for WordPress sites.
/* Delete revisions */
DELETE FROM wp_posts WHERE post_type = "revision";
/* Only use this if you no longer care about any of your current revisions! */
/* Delete trashed posts */
DELETE FROM wp_posts WHERE post_type = "trash";
/* Delete Jetpack Feedback Spam */
SELECT * FROM wp_posts WHERE wp_posts.post_type = "feedback" AND wp_posts.post_status= "spam";
@tfirdaus
tfirdaus / other.php
Created April 9, 2020 13:12 — forked from hakre/other.php
inject php declare ticks poc
<?php
/**
* just some file
*/
$a = 1;
if ($a > 0) {
$a += 2;
print($a);