Skip to content

Instantly share code, notes, and snippets.

View firmlab's full-sized avatar

firman adetia putra firmlab

  • Indonesia
View GitHub Profile
@firmlab
firmlab / metabox-repeatable-fields.php
Created March 25, 2024 03:39 — forked from ashokmhrj/metabox-repeatable-fields.php
Repeating Custom Fields with Image Uploading and drag n drop in a Metabox
<?php
/**
* Repeatable Custom Fields in a Metabox with Image upload
* Drag and Drop option
* Modified by: ashokmhrj
* Extracted from: Helen Hou-Sandi
*/
define('PATH_TO_JS','define path here');
function ask_admin_repeater_script(){
@firmlab
firmlab / tailwind-webpack-setup.md
Created June 15, 2023 02:50 — forked from bradtraversy/tailwind-webpack-setup.md
Setup Webpack with Tailwind CSS

Webpack & Tailwind CSS Setup

Create your package.json

npm init -y

Create your src folder

Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.

@firmlab
firmlab / restrictions.conf
Created May 4, 2023 03:04 — forked from urre/restrictions.conf
Nginx restrictions
# Global restrictions configuration file.
# Designed to be included in any server {} block.
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
@firmlab
firmlab / deploy_node_do.md
Created February 15, 2023 04:49 — forked from carlssonk/deploy_node_do.md
Deploy node.js app to DigitalOcean

Deploy Node.js Application to DigitalOcean

This step by step tutorial will show you how to set up a Node.js server with MongoDB to DigitalOcean using PM2, NGINX as reverse proxy and a SSL from LetsEncrypt. We will also add a custom domain name.

Prerequisites

Create Droplet & Generate SSH Key

@firmlab
firmlab / mysql-docker.sh
Created December 2, 2022 02:17 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@firmlab
firmlab / shopify-money.js
Created November 11, 2022 09:35 — forked from stewartknapman/shopify-money.js
The Shopify.formatMoney method extracted from option_selection.js for stand-alone purposes.
var Shopify = Shopify || {};
// ---------------------------------------------------------------------------
// Money format handler
// ---------------------------------------------------------------------------
Shopify.money_format = "${{amount}}";
Shopify.formatMoney = function(cents, format) {
if (typeof cents == 'string') { cents = cents.replace('.',''); }
var value = '';
var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
var formatString = (format || this.money_format);
@firmlab
firmlab / countrydropdown.html
Created March 4, 2022 00:26 — forked from danrovito/countrydropdown.html
HTML Country Select Dropdown List
<label for="country">Country</label><span style="color: red !important; display: inline; float: none;">*</span>
<select id="country" name="country" class="form-control">
<option value="Afghanistan">Afghanistan</option>
<option value="Åland Islands">Åland Islands</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>