Skip to content

Instantly share code, notes, and snippets.

@fumihumi
fumihumi / gist:d4966df51852a08b8807ba9ea0dd585b
Last active October 26, 2020 01:12
one lineer script to check the release version when 'Enumerator#with_index' added
{ fumihumi } (~): docker run --rm -e 'ALL_RUBY_SINCE=ruby-1.8' -e 'ALL_RUBY_SHOW_DUP=yes' rubylang/all-ruby ./all-ruby -e 'a=[11,22,33,44,55].to_enum; a.with_index(1) { |val,index| puts "index: #{index} for #{val}" }'
ruby-1.8.0 -e:1: undefined method `to_enum' for [11, 22, 33, 44, 55]:Array (NoMethodError)
exit 1
ruby-1.8.1 -e:1: undefined method `to_enum' for [11, 22, 33, 44, 55]:Array (NoMethodError)
exit 1
ruby-1.8.2-preview1 -e:1: undefined method `to_enum' for [11, 22, 33, 44, 55]:Array (NoMethodError)
exit 1
ruby-1.8.2-preview2 -e:1: undefined method `to_enum' for [11, 22, 33, 44, 55]:Array (NoMethodError)
exit 1
@fumihumi
fumihumi / keybindings.json
Created July 20, 2020 01:13
vscodeのkeybindings
// Place your key bindings in this file to override the defaultsauto[]
[
// move pane, like tmux
{ "key": "ctrl+b h", "command": "workbench.action.focusLeftGroup", },
{ "key": "ctrl+b l", "command": "workbench.action.focusRightGroup" },
{ "key": "ctrl+b j", "command": "workbench.action.focusBelowGroup" },
{ "key": "ctrl+b k", "command": "workbench.action.focusAboveGroup" },
{ "key": "ctrl+b n", "command": "workbench.action.focusNextGroup" },
{ "key": "ctrl+b p", "command": "workbench.action.focusPreviousGroup" },
{ "key": "ctrl+b shift+\\", "command": "workbench.action.splitEditor" },
@fumihumi
fumihumi / keybindings.json
Created July 20, 2020 01:13
vscodeのkeybindings
// Place your key bindings in this file to override the defaultsauto[]
[
// move pane, like tmux
{ "key": "ctrl+b h", "command": "workbench.action.focusLeftGroup", },
{ "key": "ctrl+b l", "command": "workbench.action.focusRightGroup" },
{ "key": "ctrl+b j", "command": "workbench.action.focusBelowGroup" },
{ "key": "ctrl+b k", "command": "workbench.action.focusAboveGroup" },
{ "key": "ctrl+b n", "command": "workbench.action.focusNextGroup" },
{ "key": "ctrl+b p", "command": "workbench.action.focusPreviousGroup" },
{ "key": "ctrl+b shift+\\", "command": "workbench.action.splitEditor" },
@fumihumi
fumihumi / rm_mysql.md
Created May 29, 2020 06:01 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@fumihumi
fumihumi / SubmitSlackGoogleForm.gs
Created February 18, 2020 04:22
Post slack when submitting Google Forms, If so, set configuration variables. And set a script trigger
const SLACK_WEBHOOK_URL = YOUR_SLACK_WEBOOK_URL;
const CHANNEL = "#xxxx";
const USER_NAME = "bot name";
function submitForm(e) {
const itemResponses = e.response.getItemResponses();
const messages = [];
for (let item of itemResponses) {
const question = item.getItem().getTitle();
@fumihumi
fumihumi / nestedObjectAccessor.ts
Created January 26, 2020 09:38
get, or set value nested objects.
// ref: https://stackoverflow.com/questions/6906108/in-javascript-how-can-i-dynamically-get-a-nested-property-of-an-object
export function getValue<T>(obj: T, path: string): T {
if (!path) return obj;
const properties = path.split(".");
return getValue(obj[properties.shift()], properties.join("."));
}
// ref: https://stackoverflow.com/questions/18936915/dynamically-set-property-of-nested-object
export function setValue<T>(obj: T, path: string, value: Pick<T, keyof T>): T {
const pList = path.split(".");
@fumihumi
fumihumi / index.html
Last active October 25, 2019 17:19
ios13's `DeviceMotionEvent.requestPermission` example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
@fumihumi
fumihumi / .bashrc
Last active January 3, 2020 08:19
minimum config setting
function share_history {
history -a
history -c
history -r
}
PROMPT_COMMAND='share_history'
shopt -u histappend
export HISTSIZE=9999
<!doctype html>
<html lang="en" data-framework="jquery">
<head>
<meta charset="utf-8">
<title>jQuery • TodoMVC</title>
<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
vendor/bundle
.rspec