Skip to content

Instantly share code, notes, and snippets.

View shohey1226's full-sized avatar

Shohei Kameda shohey1226

View GitHub Profile
@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";
  • :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 / 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)
#!/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
}
Keyboard Command Description
Command + f Search a word
Command + c Copy
Command + v Paste
Command + r Reload *Try when Terminal is hung
Keyboard Command Description
Command + s Save file
Command + c Copy
Command + v Paste
Control + Tab Change file
Command + w Close file
Command + n Open new file
Keyboard Command Description
Command + i Show hints
Command + c Copy
Command + v Paste
Command + r Reload
Control + p Scroll up
Control + n Scroll down
Command + [ Go back
Command + ] Go forward
Keyboard Command Description
Command + Tab Move window
Command + Tab + Shift Move window - Reverse
Command + / Full screen(back from Full screen)
@shohey1226
shohey1226 / .babelrc
Created November 25, 2015 03:28 — forked from joshblack/.babelrc
Whitelist transformers in `.babelrc` for projects
{
"retainLines": true,
"compact": true,
"comments": false,
"whitelist": [
"es6.arrowFunctions",
"es6.blockScoping",
"es6.classes",
"es6.constants",
"es6.destructuring",
#!/bin/bash
export PLENV_ROOT=/opt/perl5
if [[ ! -e $PLENV_ROOT ]];then
mkdir -p /opt/perl5
git clone git://github.com/tokuhirom/plenv.git $PLENV_ROOT
git clone git://github.com/tokuhirom/Perl-Build.git $PLENV_ROOT/plugins/perl-build/
$PLENV_ROOT/bin/plenv install 5.18.2
$PLENV_ROOT/bin/plenv rehash