Skip to content

Instantly share code, notes, and snippets.

View shohey1226's full-sized avatar

Shohei Kameda shohey1226

View GitHub Profile
#!/usr/bin/env bash
cmd=$1
container_name=$2
container_port=$3
host_port=$4
function usage() {
echo "Usage: $(basename ${0}) [add|list|delete] [container] [port] [host port]"
exit 1
}
@shohey1226
shohey1226 / create_g_suite_account.rb
Last active February 27, 2019 17:57
How to create GSuite user by ruby api (always confusing this due to a lack of docs..)
def create_g_suite_email
return if Rails.env.test? || Rails.env.development? # skip if it's test
g_email = "#{self.first_name}.#{self.last_name}@xxxx.com".downcase
user_object = Google::Apis::AdminDirectoryV1::User.new
user_object.primary_email = g_email
user_object.name = Google::Apis::AdminDirectoryV1::UserName.new
user_object.name.given_name = self.first_name
user_object.name.family_name = self.last_name
user_object.password = 'xxxxxxxxxxxx'
response = admin_directory.insert_user(user_object)
  • :winc (=Ctrl-w) e.g. :winc l
  • g+t/T (=tab move)
  • number+ g+t (=move the tab) e.g. 2 g t
  • :tabs (=show list of tabs)
  • Ctrl-e (set keymap to toggle tree view)
  • Ctrl-u Ctrl-p file search
  • Ctrl-u Ctrl-g pattern seach
  • :%y+ yank all contents in the file
@shohey1226
shohey1226 / load-jquery-turbo.md
Last active June 2, 2022 22:32
How to load Jquery with Turbo

Googling Turbo is hard. Always google hits turbolinks. It needs to use -turbolink all the time. And less document comparing to turbolinks.

There is an event similar to turbolink to load JS.

import "@hotwired/turbo-rails"; 
import "controllers";
import jquery from "jquery";