Skip to content

Instantly share code, notes, and snippets.

View zetavg's full-sized avatar

Pokai Chang zetavg

View GitHub Profile
function copyUberEatsMenuItems() {
const items = getUberEatsMenuItems()
copy(
items
.map(i => `${i.name}\t${i.price}`)
.join('\n')
)
}
function getUberEatsMenuItems() {
@zetavg
zetavg / rails.log
Created April 3, 2020 17:45
Rails, Passenger, Nginx, Nix: uninitialized constant Bundler::Settings (NameError)
Error: The application encountered the following error: uninitialized constant Bundler::Settings (NameError)
/nix/store/li2vmpp6mxqzrs6s95szj1xga380hsv4-sample-rails-app-dev-bundler-env/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/settings.rb:6:in `<module:Bundler>'
/nix/store/li2vmpp6mxqzrs6s95szj1xga380hsv4-sample-rails-app-dev-bundler-env/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/settings.rb:5:in `<top (required)>'
/nix/store/928i2cf1wizgm7dapmnk0m8ijrsjdj43-ruby-2.5.7/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/nix/store/928i2cf1wizgm7dapmnk0m8ijrsjdj43-ruby-2.5.7/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/nix/store/li2vmpp6mxqzrs6s95szj1xga380hsv4-sample-rails-app-dev-bundler-env/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler.rb:273:in `settings'
/nix/store/li2vmpp6mxqzrs6s95szj1xga380hsv4-sample-rails-app-dev-bundler-env/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler.rb:84:in `configured_bundle_path'
@zetavg
zetavg / machine.js
Created December 25, 2019 09:55
Generated by XState Viz: https://xstate.js.org/viz
const appMachine = Machine({
id: 'app',
initial: 'unauthenticated',
states: {
unauthenticated: {
on: {
LOGIN: 'authenticated',
},
},
authenticated: {
@zetavg
zetavg / index.js
Last active October 15, 2019 12:12
telegraf-keyboard-bot on Google Cloud Functions
/**
* telegraf-keyboard-bot
*
* Function to execute: handleRequest
*
* Required environment variables:
*
* - TELEGRAM_BOT_AUTHENTICATION_TOKEN
*
* Run
@zetavg
zetavg / machine.js
Last active September 15, 2019 16:24
Generated by XState Viz: https://xstate.js.org/viz
const citizenQuartzMultiAlarmIIIMachine = Machine({
id: 'citizen-quartz-multi-alarm-iii',
initial: 'displays',
states: {
'displays': {
initial: 'time',
states: {
'time': {
on: {
@zetavg
zetavg / machine.js
Created September 9, 2019 14:55
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@zetavg
zetavg / apm-server.yml
Created August 6, 2019 06:51
Sample Elastic APM Server Config (7.0.1)
################### APM Server Configuration #########################
############################# APM Server ######################################
apm-server:
# Defines the host and port the server is listening on. use "unix:/path/to.sock" to listen on a unix domain socket.
host: "localhost:8200"
# Maximum permitted size in bytes of a request's header accepted by the server to be processed.
#max_header_size: 1048576
@zetavg
zetavg / README.md
Last active April 30, 2023 17:59
用 Haskell 的 list comprehension 來解某數學愛好者社團的某題目 (https://www.facebook.com/photo.php?fbid=2475098332534617)
function useCallback(callback) {
const callbackRef = React.useRef(callback)
callbackRef.current = callback
const wrappedCallback = React.useMemo(
() => (...args) => callbackRef.current(...args),
[],
)
return wrappedCallback
}
@zetavg
zetavg / sb-calibre-azw3-kindle.md
Last active February 15, 2025 14:58
直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版(翻頁相反、字體走位)的解決方法。

直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版的解決方法

圖為修正後範例。

有些直書書籍轉成 azw3 後排版會跑掉,在 Kindle 上僅剩翻頁變相反、從左到右的(因為原本是直書呀)。這裡是一些解決方法。

首先對要修正的書按右鍵選編輯,然後選 AZW3

1. 直書變橫書