Skip to content

Instantly share code, notes, and snippets.

View remy727's full-sized avatar
🏠
Working from home

Remy Wang remy727

🏠
Working from home
View GitHub Profile
@remy727
remy727 / js-generator-function.js
Last active May 3, 2023 13:08
JavaScript Generator Function
function *foo(x) {
while (x < 4) {
x += yield x;
}
return x;
}
var bar = foo(3);
console.log( bar.next(1) );
console.log( bar.next(1) );
console.log( bar.next(1) );
@remy727
remy727 / js-event-loop.js
Created January 28, 2022 08:28
JavaScript Event Loop
setTimeout(() => console.log(1), 100)
setTimeout(() => console.log(2), 0)
Promise.resolve(42).then(() => {
console.log(3);
setTimeout(() => console.log(4), 50);
})
.then(() => Promise.reject(new Error(22)))
.then(() => console.log(5))
.catch((e) => console.log(6, e.message))
@remy727
remy727 / ruby-built-in-exceptions.md
Last active May 3, 2023 12:58
Built-In Exception Classes(Ruby 3.2.1)

Built-In Exception Classes(Ruby 3.2.1)

  • NoMemoryError
  • ScriptError
    • LoadError
    • NotImplementedError
    • SyntaxError
  • SecurityError
  • SignalException
    • Interrupt
  • StandardError
@remy727
remy727 / tmux-cheatsheet.markdown
Created July 25, 2023 19:46 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@remy727
remy727 / react-polaris-multiple-select-component.js
Created August 15, 2023 16:33
React Polaris multiple select component
import {
useCallback,
useState,
} from "react";
import {
Button,
Checkbox,
Collapsible,
Icon,
Modal,
@remy727
remy727 / rails-timezone-list.json
Last active September 5, 2023 19:26
Rails timezone list JON
[
{
"label": "(UTC-12:00) Etc/GMT+12",
"rails_timezone": "International Date Line West",
"tzinfo_identifier": "Etc/GMT+12"
},
{
"label": "(UTC-11:00) Pacific/Pago_Pago",
"rails_timezone": "American Samoa",
"tzinfo_identifier": "Pacific/Pago_Pago"
@remy727
remy727 / heroku-alternatives.md
Last active November 28, 2023 15:33
Heroku Alternatives
@remy727
remy727 / detect-the-client-s-device-using-shopify-app-bridge-utilities.js
Created November 6, 2023 09:35
Detect the client's device using Shopify App Bridge Utilities
import {
isShopifyEmbedded,
isMobile,
isShopifyMobile,
isShopifyPOS
} from '@shopify/app-bridge/utilities';
const onShopifyEmbedded = isShopifyEmbedded();
const onMobile = isMobile();
const onShopifyMobile = isShopifyMobile();
@remy727
remy727 / shopify-rest-admin-api-example.rb
Created November 23, 2023 14:16
Shopify REST Admin API Example
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails"
@remy727
remy727 / show-order-additional-details-in-notification-on-shopify.liquid
Created November 29, 2023 11:56
Show order additional details in notification on Shopify
{% for attribute in attributes %}
{% assign key = attribute | first | downcase | strip %}
{% if key == "your_attribute_name" %}
Your attribute name: {{ attribute | last }}
{% endif %}
{% endfor %}