Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Fery Wardiyanto feryardiant

🎯
Focusing
Block or report user

Report or block feryardiant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@feryardiant
feryardiant / README.md
Last active Mar 20, 2019
Simple tricks for working with Laravel Mix
View README.md

Simple tricks for working with Laravel Mix

Problems

  1. Start PHP development server or (artisan serve) along side webpack-dev-server in single command
  2. Serve static files inside storage/app/public without creating symlink to public directory

Solution

  1. Use node child_process to spawn artisan serve command while starting webpack-dev-server
@feryardiant
feryardiant / wildcard-localhost.md
Last active Jun 25, 2018
Wildcard subdomains of localhost by Evans.io
View wildcard-localhost.md

It always slightly niggled that I couldn’t just stick a *.localhost entry in /etc/hosts and have all subdomains of localhost resolve to 127.0.0.1. But setting up a local nameserver, and making sure external domains still got resolved properly, always seemed like too much faff. It turns out though, thanks to dnsmasq, that it’s actually very straightforward. (Instructions are for Ubuntu but dnsmasq runs on most *nix systems.)

  1. Install dnsmasq, a DNS forwarder which you can configure to reply to certain queries locally and forward all others on to your external nameservers:

    sudo aptitude install dnsmasq
    
  2. Configure it to resolve all localhost domains to 127.0.0.1. By default, dnsmasq will include all files in /etc/dnsmasq.d/ so create a new file here with a sensible name like /etc/dnsmasq.d/localhost.conf and add the following line:

@feryardiant
feryardiant / twbs_comment_form_defaults.php
Created Oct 24, 2017
Twitter Bootstrap Comment Form for Wordpress
View twbs_comment_form_defaults.php
<?php
if ( ! function_exists( 'twbs_comment_form_defaults' ) ) {
/**
* Customize default wp comment form.
*
* @link https://developer.wordpress.org/reference/hooks/comment_form_defaults/
* @link https://codex.wordpress.org/Function_Reference/comment_form
*
* @param array $defaults
View install_nvm.sh
#!/usr/bin/env sh
[ -d ~/.nvm ] && rm -rf ~/.nvm
git clone -q https://github.com/creationix/nvm.git ~/.nvm
cd ~/.nvm && git checkout -q `git describe --abbrev=0 --tags`
@feryardiant
feryardiant / README.md
Last active Jan 21, 2016
Thue Morse Sequence - PHP Implementation
View README.md

Thue Morse Sequence - PHP Implementation

Recently, I got a job vacancy test and this is the one of questions i've got. I'm absolutely new here so CMIIW 😉

Usage

Simply download the gist and create new file called whatever.php then copy-paste lines below:

!#/usr/bin/env php
@feryardiant
feryardiant / install_libsass.sh
Last active Jun 18, 2019
Easy way to Install libsass & sassc in Ubuntu, `curl -sSL http://git.io/vnxQ4 | sudo bash`
View install_libsass.sh
#!/bin/bash
# Based on https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87
set -e
# Installing dependencies
apt-get -q -y install build-essential automake libtool git
buildDir="/tmp/sass-build"
@feryardiant
feryardiant / README.md
Last active Aug 29, 2015
Array Order by
View README.md

Example Usage

$data = [
  [ 'parent'=> 1, 'id' => 4, 'data' => 'empat', ], 
  [ 'parent'=> 4, 'id' => 2, 'data' => 'dua',   ], 
  [ 'parent'=> 0, 'id' => 3, 'data' => 'tiga'   ], 
  [ 'parent'=> 3, 'id' => 1, 'data' => 'satu'   ]
];
@feryardiant
feryardiant / Lumen_Slim2_Slim3_Panada_Ci3.md
Last active Jul 29, 2016
Just try to bench using AB, Lumen vs Slim 2.x vs Slim 3.dev vs Panada vs Codeigniter 3.x
View Lumen_Slim2_Slim3_Panada_Ci3.md

Benchmarks tldr;

OS: Ubuntu 14.04 64bit
Server Hostname: localhost
Server Software: PHP 5.5.23 Build-in server
Benchmark command: ab -t 60 -c 5

Bench Lumen Slim 2.x Slim 3.x Silex Panada CI 3
Document Path / / / / / /
@feryardiant
feryardiant / vagrant-vbga-update
Last active Oct 31, 2016 — forked from zbal/gist:7800423
Update VBox Guest Additions on Ubuntu Guest (Vagrant)
View vagrant-vbga-update
# Start the old vagrant
vagrant@host:~$ sudo su
root@host:/home/vagrant# sudo wget -c http://download.virtualbox.org/virtualbox/4.3.10/VBoxGuestAdditions_4.3.10.iso -O VBoxGuestAdditions_4.3.10.iso
root@host:/home/vagrant# mount VBoxGuestAdditions_4.3.10.iso -o loop /mnt
mount: block device /home/vagrant/VBoxGuestAdditions_4.3.10.iso is write-protected, mounting read-only
root@host:/home/vagrant# cd /mnt
root@host:/mnt# sh VBoxLinuxAdditions.run --nox11
root@host:/mnt# cd ~
root@host:/mnt# VBoxGuestAdditions_4.3.10.iso
root@host:/mnt# ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
@feryardiant
feryardiant / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.