Skip to content

Instantly share code, notes, and snippets.

@timurcatakli
timurcatakli / webpack.config.js
Last active May 1, 2023 18:25
An Easy to Understand Webpack 4+ Configuration File with Comments
const publicPath = 'public';
// Node os module
// The os module provides a number of operating system-related utility methods.
// It can be accessed using:
const os = require('os');
// Using a single monolithic configuration file impacts comprehension and
// removes any potential for reusability.
// As the needs of your project grow, you have to figure out the means to manage
// webpack configuration more effectively.

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@ridem
ridem / README.md
Last active June 27, 2022 07:37
Download a Shopify store's assets used in your theme

It's hard to migrate section themes that rely heavily on images. This bit of code helps you download all the CDN assets of your theme.

  1. Create a cdn_assets folder
  2. Create the download_assets.js file at the root of your project
  3. Edit the download_assets.js file to match the path to your settings_data.json (line 3)
  4. Edit the download_assets.js file to set the "CDN code" of your store. Each file that you upload from /admin/settings/files gets uploaded with the following format: https://cdn.shopify.com/s/files/1/YOUR_CDN_CODE/files/YOURFILE. The format of the code is /\d{4}\/\d{4}/ (four digits, a forward slash, and four digits)
@djrmom
djrmom / facet.css
Last active November 19, 2019 03:56
facetwp css classes
/**
** facet classes
**/
.facetwp-facet {
/* class of div that wraps each facet type */
}
.facetwp-facet-FACET-NAME {
/* class for a facet where facet name is FACET-NAME, applied to same div as .facetwp-facet */
}
@mburakerman
mburakerman / package.json
Last active September 26, 2022 17:32
Webpack 4 config.js (SCSS to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-sass",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
@douglasanro
douglasanro / add-numeric-pagination-to-your-theme.php
Created April 16, 2017 21:01
Add numeric pagination to your WordPress theme
<?php
/* ----------------------------------------------------------------------------
* Add numeric pagination to your theme
* ------------------------------------------------------------------------- */
function numeric_posts_nav() {
if( is_singular() )
return;
@jestho
jestho / package.json
Created February 27, 2017 22:03
Quick Sass/BrowserSync
{
"name": "flow",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "npm-run-all --parallel styles:watch browsersync",
"styles:watch": "node-sass --watch style.scss style.css",
"browsersync": "browser-sync start --server --files \"*.html, *.js, *.css\""
},
@vovadocent
vovadocent / readonly_and_disabled_to_text_acf.php
Last active April 26, 2024 21:52
Readonly and disabled to ACF text field
<?php
add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field');
function add_readonly_and_disabled_to_text_field($field) {
acf_render_field_setting( $field, array(
'label' => __('Read Only?','acf'),
'instructions' => '',
'type' => 'radio',
'name' => 'readonly',
'choices' => array(
1 => __("Yes",'acf'),
@davidjb
davidjb / recovery.sh
Created December 21, 2016 08:21
Create macOS Sierra Recovery Partition Without Reinstalling
TARGET="/Volumes/Macintosh HD" # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install\ macOS\ Sierra.app" # Path to your macOS installer
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg
hdiutil mount ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate