Skip to content

Instantly share code, notes, and snippets.

View nhosoya's full-sized avatar
😯
free

Naoki Hosoya nhosoya

😯
free
View GitHub Profile
# frozen_string_literal: true
require 'slack-ruby-client'
Slack.configure do |config|
config.token = ENV['SLACK_API_TOKEN']
config.logger = Logger.new(STDOUT)
config.logger.level = Logger::INFO
raise "Missing ENV['SLACK_API_TOKEN']!" unless config.token
end
l = ("a".."z").to_a
h = ("A".."Z").to_a
target = "abcAbc"
target.chars.map do |c|
if l.index(c)
l[(l.index(c) + 13) % 26]
elsif h.index(c)
h[(h.index(c) + 13) % 26]
else
@nhosoya
nhosoya / page-transition-by-arrow-key.js
Last active March 12, 2020 01:53
「小学館版学習まんが少年少女日本の歴史」を方向キーでページ遷移させる
// https://kids-km3.shogakukan.co.jp/
var event = document.createEvent("HTMLEvents");
event.initEvent("click", true, true);
document.onkeydown = keydown;
function keydown(e) {
if (e.key === 'ArrowLeft') {
document.querySelector("#tap_left_area").dispatchEvent(event);
}
if (e.key === 'ArrowRight') {
@nhosoya
nhosoya / appleid.auth.js
Created June 4, 2019 03:48
Sign In with Apple
/**
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* # Sign In with Apple License
*
* **IMPORTANT:** This Sign In with Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, reproduction, or installation of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, reproduce or install this Apple software.
*
* This software is licensed to you only for use with Sign In with Apple that you are authorized or legally permitted to embed or display on your website.
*
* The Sign In with Apple software is only licensed and intended for the purposes set forth above and may not be used for other purposes or in other contexts without Apple's prior written permission. For the sake of clarity, you may not and agree not to or enable others to, modify or create derivative works of the Sign In with Apple software.
fun main(args: Array<String>) {
val foo = "ab cd"
println(foo)
println(foo.replace("\u0020", "")) // 10進数で32
println(foo.replace("\u00A0", "")) // 10進数で160
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.20179691910743713</real>
<key>Green Component</key>
<real>0.1818026602268219</real>
@nhosoya
nhosoya / genymotionwithplay.txt
Created November 19, 2016 11:12 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
#!/bin/bash
set -e
set -x
set -u
function init() {
export YMDHMS=`date +%Y%m%d%H%M%S`
}
function validate_environment_variable() {
@nhosoya
nhosoya / slack_post.sh
Created April 23, 2015 09:44
Slackに通知するスクリプト
#!/bin/bash
WEBHOOKURL="$1"
MESSAGEFILE=$2
CHANNEL="$3"
BOTNAME="$4"
FACEICON="$5"
TMPFILE=$(mktemp)
cat ${MESSAGEFILE} | tr '\n' '\\' | sed 's/\\/\\n/g' | sed 's/\"/\\\"/g' > ${TMPFILE}