Skip to content

Instantly share code, notes, and snippets.

View feryardiant's full-sized avatar
🎯
Focusing

Fery Wardiyanto feryardiant

🎯
Focusing
View GitHub Profile
@feryardiant
feryardiant / homebrew.mxcl.php.plist
Created May 24, 2024 08:54
Fix php-fpm 502 issue on M1 mac
<key>EnvironmentVariables</key>
<dict>
<key>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</key>
<string>YES</string>
</dict>
@feryardiant
feryardiant / launch.json
Created May 24, 2024 08:51
VS Code launch.json to start artisan serve with xdebug enabled
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Artisan Serve",
"type": "php",
"request": "launch",
@feryardiant
feryardiant / Microsoft.PowerShell_profile.ps1
Created April 10, 2020 23:24
Simple PowerShell function to start docker-machine on Windows 10 Home
function docker-start
{
docker-machine start docker-vm
docker-machine env docker-vm --shell powershell | Invoke-Expression
}
Verifying my Blockstack ID is secured with the address 1Mt1if5X7f8NWAbYhc7TbdY1iD372EKj34 https://explorer.blockstack.org/address/1Mt1if5X7f8NWAbYhc7TbdY1iD372EKj34
@feryardiant
feryardiant / README.md
Last active March 20, 2019 13:17
Simple tricks for working with Laravel Mix

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 June 25, 2018 04:42
Wildcard subdomains of localhost by Evans.io

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 October 24, 2017 17:04
Twitter Bootstrap Comment Form for Wordpress
<?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
@feryardiant
feryardiant / install_nvm.sh
Last active October 8, 2016 22:23
Install NVM
#!/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 January 21, 2016 14:33
Thue Morse Sequence - PHP Implementation

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 June 26, 2021 20:09
Easy way to Install libsass & sassc in Ubuntu, `curl -sSL http://git.io/vnxQ4 | sudo bash`
#!/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"