Skip to content

Instantly share code, notes, and snippets.

View max-hk's full-sized avatar

max-hk

View GitHub Profile
@odessy
odessy / change_product_option.js
Last active July 17, 2020 18:13
Story change product option: story theme modification of https://gist.github.com/drabbytux/a49215c6d0ba16c4d096a56212bbc4ce
$(document).ready(function() {
thumbnails = $('.product__thumbs img[src*="/products/"]');
if (thumbnails.length) {
thumbnails.on('click', function() {
var arrImage = $(this).attr('src').split('?')[0].split('.');
var strExtention = arrImage.pop();
var strRemaining = arrImage.pop()
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|crop|center)/gi, '')
.replace(/_[a-zA-Z0-9@]+$/,'');
var strNewImage = arrImage.join('.')+"."+strRemaining+"."+strExtention;
@jakub-g
jakub-g / async-defer-module.md
Last active May 25, 2024 18:23
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@samoshkin
samoshkin / postman_vs_insomnia_comparison.md
Created November 6, 2018 17:42
Comparison of API development environments: Postman vs Insomnia

Postman vs Insomnia comparison

Postman | API Development Environment https://www.getpostman.com
Insomnia REST Client - https://insomnia.rest/

Features                                        Insomnia Postman Notes
Create and send HTTP requests x x
Authorization header helpers x x Can create "Authorization" header for you for different authentication schemes: Basic, Digest, OAuth, Bearer Token, HAWK, AWS
@weihanglo
weihanglo / rust-vs-go.md
Last active April 28, 2024 01:21
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!


@drexler
drexler / install.sh
Created May 24, 2018 16:03
Install Chrome under WSL
# assumes you have ubuntu-desktop installed which includes stock libpulse
sudo add-apt-repository ppa:therealkenc/wsl-pulseaudio
sudo apt-get update && sudo apt-get upgrade
# Download the stable or development Chrome .deb package - dev if you want headless functionality
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt -f install # probably
wget https://github.com/therealkenc/libudev-stub/releases/download/v0.9.0/libudev-stub-0.9.0-WSL.deb
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@maxpou
maxpou / github-page-travis.md
Last active March 20, 2023 04:02
Auto deploy on GitHub Pages when commit on master (with TravisCI)

Auto deploy on GitHub Pages when commit on master (with TravisCI)

Repo side

  1. touch .travis.yml
  2. Copy paste the following
language: node_js
node_js: stable
@JohannesDeml
JohannesDeml / README.md
Last active May 17, 2024 23:09
Batch convert images with inkscape on windows

Batch convert svg|pdf|eps|emf|wmf|ai|ps|cdr to eps|pdf|png|jpg|tiff|svg|ps|emf|wmf

Screenshot Batch converter for Windows using Inkscape with the command line
InkscapeBatchConvert is an easy to use solution to quickly convert all files of a folder to another type without the need to open Inkscape. The program uses Windows Batch scripting and will only work on Windows.
Tested with Inkscape 1.0.x - 1.3.x ✅ (The last version that supports Inkscape 0.9.x can be found here)

Usage

  1. Download _InkscapeBatchConvert.bat
  2. Put it in the folder where you have files you wish to convert (will also scan on all subfolders for files of input type).
  3. Then double click the file to start it.
@kellyrmilligan
kellyrmilligan / start.js
Created December 13, 2017 21:01
start.js - adjusted
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
@dlinsley
dlinsley / find_duplicate_objects.py
Last active September 28, 2023 17:18
Find duplicate objects in an aws s3 bucket by comparing ETag
#!/usr/bin/env python3
import boto3
import argparse
import string
parser = argparse.ArgumentParser('Find duplicate objects in an aws s3 bucket')
parser.add_argument('--bucket', dest='myBucket', default='yourBucketName', help='S3 Bucket to search')
cliArgs = parser.parse_args()