Skip to content

Instantly share code, notes, and snippets.

View hiroy's full-sized avatar

YAMAOKA Hiroyuki hiroy

View GitHub Profile
@hiroy
hiroy / index.js
Created August 29, 2019 13:55
SSL/TLSの証明書の有効期間をSlackに通知するツール
'use strict';
const { IncomingWebhook } = require('@slack/client');
const https = require('https');
const moment = require('moment');
async function sendSlackNotification(message) {
const url = process.env.SLACK_INCOMING_WEBHOOK_URL;
const slackIncomingWebhook = new IncomingWebhook(url);
return await slackIncomingWebhook.send({
@hiroy
hiroy / index.js
Last active June 12, 2019 12:45
SendGridのEvent Notificationの内容をGoogle Cloud Functionsで受け取ってSlackに通知するサンプル
const { IncomingWebhook } = require('@slack/client');
const moment = require('moment');
// SLACK_INCOMING_WEBHOOK_URL と
// SECRET_QUERY_TOKEN を環境変数で設定、
// SendGrid の HTTP POST URL には
// ?token= で SECRET_QUERY_TOKEN に設定した値を
// トリガーのURLに付けたものを設定すること
async function sendNotification(message) {
@hiroy
hiroy / Dispatcher.php
Created May 22, 2019 13:50
雑なHTTP Handler(Middleware、RequestHandler)のdispatcher
<?php
declare(strict_types=1);
namespace Kurumi;
use InvalidArgumentException;
use LogicException;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@hiroy
hiroy / gist:75b83d055563e3008909
Last active August 29, 2015 14:05
ゆるデ部室

ゆるデ部室

第1回meetupによせて

初めましての方もそうでない方もこんばんは。

合同会社qumuあらため合同会社テンマド(10mado, LLC)の山岡(@hiro_y)です。

この中にフリーランスの方、どれぐらいいらっしゃるでしょうか。 また、例えば就業後とか週末とか、自宅じゃない作業場所がほしい人は?

@hiroy
hiroy / .bash_profile
Last active December 19, 2015 04:39
Xcodeのgitを使っているときのpromptにブランチ名を表示するように
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=auto
export PS1='\[\033[36m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\033[34m\]$(__git_ps1)\[\033[00m\] \$ '
@hiroy
hiroy / deploy.pl
Created February 4, 2013 08:01
Cinnamonを使ってみるサンプル
use strict;
use warnings;
use Cinnamon::DSL;
set application => 'myapp';
set repository => 'git@github.com:yourname/myapp.git';
role devel => ['aws-myapp-01'], {
deploy_to => '/home/ec2-user/apps/myapp-devel',
branch => 'master',
@hiroy
hiroy / gist:3803426
Created September 29, 2012 07:25
iPhone 5のスクリーンショットからステータスバーをカット。App Store提出用に。
# for 4-inch display (iPhone 5)
convert -crop 640x1096+0+40 input.png output.png
# for 3.5-inch display (iPhone 4/4S)
convert -crop 640x920+0+40 input.png output.png
@hiroy
hiroy / composer.json (using Packagist)
Created August 1, 2012 17:09
Karintoを導入するためのcomposer.json
{
"require": {
"karinto/karinto": "dev-master"
}
}
@hiroy
hiroy / PHPでのUTF-8-MAC対応例
Created June 28, 2012 03:42
MacからのファイルアップロードでNFDで正規化された日本語ファイル名をNFCでの正規化にnormalizeするサンプル
<?php
$name = $_FILES['inputname']['name'];
if (Normalizer::isNormalized($name, Normalizer::FORM_D)) {
$_FILES['inputname']['name'] = Normalizer::normalize($name, Normalizer::FORM_C);
}
@hiroy
hiroy / jquery.taphold.js
Created January 25, 2012 17:41
taphold的なプラグイン
(function($) {
$.fn.taphold = function(tapholdCallback, duration) {
var timerId;
var toClick = true;
duration = duration || 720;
if (typeof window.ontouchstart !== "undefined"
&& typeof tapholdCallback == "function") {
$(this).css("webkitTouchCallout", "none");
$(this).on("touchstart", function(e) {
e.preventDefault();