Skip to content

Instantly share code, notes, and snippets.

View mmyoji's full-sized avatar
🙃

mmyoji mmyoji

🙃
View GitHub Profile
@mmyoji
mmyoji / strToHTML.ts
Last active September 1, 2021 09:41
Parse HTML string to raw DOM
/**
* @example
* document.getElementById("messages").append(
* strToHTML('<div class="message">foo</div>')
* );
*/
function strToHtml(rawStr: string) {
var parser = new DOMParser();
var html = parser.parseFromString(rawStr, 'text/html');
return html.body.children[0];
@mmyoji
mmyoji / dynamo_scan_paging_with_ruby_sdk.md
Last active May 15, 2024 05:33
DynamoDB Scan paging w/ Ruby SDK
@mmyoji
mmyoji / action_view_render_method_from_anywhere.md
Last active March 15, 2019 22:38
Calls render method directly in Rails
@mmyoji
mmyoji / pre-commit
Last active June 17, 2022 01:44
pre-commit
#!/bin/sh
# http://qiita.com/yuku_t/items/ad072418290a2b01a35a
# A: Added
# M: Modified
files=$(git diff --cached --name-only --diff-filter=AM | grep '\.rb$')
if [ -n "$files" ]; then
bundle exec rubocop --force-exclusion ${files}
# For docker:
@mmyoji
mmyoji / variable_test.yaml
Last active March 15, 2019 21:57
Testing YAML variables
ja:
activerecord:
models:
admin_user: 管理ユーザー
attributes:
default: &default
nickname: ニックネーム
email: メールアドレス
bio: BIO
@mmyoji
mmyoji / hyphenize.ts
Last active July 5, 2023 12:23
Replace camelCaseString with dashed-string
/**
* @example
* ```ts
* hyphenize("someCamelCaseString");
* //=> "some-camel-case-string"
*
* hyphenize("ABigHouse");
* //=> "a-big-house"
* ```
*/