Skip to content

Instantly share code, notes, and snippets.

View hosh's full-sized avatar

Ho-Sheng Hsiao hosh

  • Solace Health
  • Phoenix, AZ
View GitHub Profile
@hosh
hosh / some_api.rb
Last active August 29, 2015 14:16
A neat thing you can do with Intermodal + functional Ruby
require 'rlet/functional'
module SomeApi
module API
class V1_0 < Intermodal::API
using RLet::Functional
self.default_per_page = 25
map_data do

Keybase proof

I hereby claim:

  • I am hosh on github.
  • I am hosh (https://keybase.io/hosh) on keybase.
  • I have a public key whose fingerprint is 4F16 11A6 0573 ACDB 6695 A803 C33D 336C 2601 19B8

To claim this, I am signing this object:

@hosh
hosh / tmux.conf
Created October 25, 2016 19:20
tmux.conf
# Disable delay in escape so that spacemacs will work under here
set -s escape-time 0
# utf-8 support
setw -g utf8 on
set -g status-utf8 on
set -g default-terminal "screen-256color"
set -g prefix C-z
unbind-key C-b
@hosh
hosh / redis.rb
Created May 24, 2017 19:19
Matsuri Example
# Matsuri.define will generate a custom class and registers it
# Because it is a Ruby class, you can create mixins by creating a Ruby
# module and `include` it in.
# Everything is broken down into smaller `let()`. If you are not familiar
# with it, it is taken from Rspec, and defines a memoized method. We can
# then customize functionality by overriding any of the lets. In this case,
# the base class of the pod definition defines the manifests:
# https://github.com/matsuri-rb/matsuri/blob/master/lib/matsuri/kubernetes/pod.rb#L10
# Notice how I am overriding just enough to create a pod. However, I can override
@hosh
hosh / convert_to_post.ex
Created October 13, 2018 00:23
Kludge to add additional body_params parsing for HTTP verbs such as REPORT
defmodule Legalio.Plug.ConvertToPost do
@moduledoc """
A Plug to convert a list of methods to POST so
that body_params can be populated
"""
@behaviour Elixir.Plug
alias Elixir.Plug.Conn
@hosh
hosh / shutdown.ts
Created November 24, 2025 18:27
Nodejs shutdown handler
'use strict';
/* This module handles shutdown procedures to ensure a graceful shutdown
- Function to register a shutdown callbacks
- Call shutdown callbacks on uncaught promise rejections and signals
- Call the exported setup() at the top of the bootup, usually in main.ts
*/
// import your logging code here
const log = (level, message) => {