Skip to content

Instantly share code, notes, and snippets.

View qpSHiNqp's full-sized avatar
🏠
Working from home

Shintaro Tanaka qpSHiNqp

🏠
Working from home
View GitHub Profile
@qpSHiNqp
qpSHiNqp / modules_spec.rb
Created March 12, 2019 06:25
Modules included by a context block doesn't take effect in another context block
require 'spec_helper'
describe RSpec, 'module isolation' do
module Example1
def hoge
"example1"
end
end
module Example2
def hoge
@qpSHiNqp
qpSHiNqp / environment_name.sh
Created October 2, 2018 09:17
Elastic Beanstalkのdocker環境のホスト上で自分の環境名を得る
#!/bin/sh
aws ec2 describe-tags --region ap-northeast-1 --filters "Name=resource-id,Values=`curl http://169.254.169.254/latest/meta-data/instance-id`" "Name=key,Values=elasticbeanstalk:environment-name" | jq -r .Tags[0].Value
# regionは適宜適宜してください。
@qpSHiNqp
qpSHiNqp / failover-play-btn.html
Created July 10, 2018 08:38
単純な再生ボタン
<style>
.failover-play-btn {
width: 60px;
height: 60px;
background: rgba(255, 255, 255, 0.7) no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 15' fill='dimgray'%3E %3Cpath d='M 0,1 12,7.5 0,14 z'/%3E %3C/svg%3E") 64% 50%/50%;
border-radius: 50%;
border: none;
cursor: pointer;
}
</style>
@qpSHiNqp
qpSHiNqp / screenshotsFromTimeline.js
Last active January 18, 2016 09:34
Derives a bunch of web page screenshot PNGs from a Chrome Timeline data JSON which can be saved in DevTools > Timeline recordings
/**
* usage: node screenshotsFromTimeline.js <input timeline data json>
*
* Derives a bunch of web page screenshot PNGs from a Chrome Timeline data JSON which can be saved in DevTools > Timeline recordings
* Runs with node.js
*/
var util = require('util');
var fs = require('fs');
function usage() {
@qpSHiNqp
qpSHiNqp / auto_queue.js
Created June 3, 2015 11:19
AutoQueue: A queue that runs the given process with an interval if some values are queued and stops if there is no value queued.
/**
* class AutoQueue
*
* queue that runs the given process with an interval if some values are queued
* and stops if there is no value queued.
* 値がqueueされていれば一定間隔で与えられた関数に値を渡し、queueされていなければ黙っているqueue.
*
* @constructor
* @param {Function} func
* @param {number} interval
@qpSHiNqp
qpSHiNqp / URLEncoder.lua
Created November 14, 2014 07:11
URLEncoder/Decoder for lua
--[[----------------------------------------------------------------------------
Copyright 2014 S. Tanaka
All Rights Reserved.
--------------------------------------------------------------------------------
URLEncoder.lua
Encodes any strings into URL encoded strings with a rule based on rawurlencode in PHP.