Skip to content

Instantly share code, notes, and snippets.

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

tomcky TomckySan

🏠
Working from home
View GitHub Profile
<?php
require 'vendor/autoload.php';
use PHPUnit\Framework\TestCase;
use Carbon\Carbon;
class Greeter
{
/**
* PHP標準で用意されているDateTimeだと
<?php
class Block
{
private $index;
private $previousHash;
private $timestamp;
private $data;
private $hash;
@TomckySan
TomckySan / main.js
Created January 5, 2018 14:57
「テスト駆動開発」JS(AVA)
class Bank {
constructor() {
this.rates = new Map();
}
reduce(source, to) {
return source.reduce(this, to);
}
addRate(from, to, rate) {
@TomckySan
TomckySan / JavaScriptの圧縮にUglifyJSを使う.md
Last active December 1, 2017 08:03
JavaScriptの圧縮にUglifyJSを使う

UglifyJS

uglifyjs src/js/input.js --compress drop_console=true --mangle -o build/js/output.js
@TomckySan
TomckySan / fillzero.rb
Last active November 29, 2016 05:33
桁数指定ゼロ埋め
# % (String) - https://docs.ruby-lang.org/ja/latest/class/String.html#I_--25
puts "%02d" % 0 # 00
puts "%02d" % 9 # 09
puts "%02d" % 99 # 99
puts "%02d" % 100 # 100
puts "%04d" % 0 # 0000
puts "%04d" % 9 # 0009
puts "%04d" % 99 # 0099
puts "%04d" % 100 # 0100
puts "%04d" % 9999 # 9999
@TomckySan
TomckySan / gas_for_chatwork_001.js
Created August 8, 2016 02:57
GASからChatworkへ打刻しろよ的なことを促すスクリプト
var MSG_HELLO = 'おはようございます(・∀・)\n勤怠管理システムからの打刻を忘れないようにしましょう!\n' + KINTAI_SYSTEM_URL;
var MSG_GOODBYE = 'おつかれさまでした(*´ω`*)\n勤怠管理システムからの打刻を忘れないようにしましょう!\n' + KINTAI_SYSTEM_URL;
function helloMessage() {
var client = ChatWorkClient.factory({token: TOKEN}); //チャットワークAPIトークン
client.sendMessage({
room_id:ROOM_ID, //ルームID
body: MSG_HELLO
});
}
@TomckySan
TomckySan / eccube3_setup.sh
Last active December 30, 2016 19:18
ECCUBE 3.0系の環境構築用シェルスクリプト(CentOS 7 on Docker)
#!/bin/bash
# パッケージ更新
yum -y update
# ロケール変更
localedef -vc -i ja_JP -f UTF-8 ja_JP.UTF-8
localectl set-locale LANG=ja_JP.utf8
# タイムゾーン変更
@TomckySan
TomckySan / grep_recursively.sh
Last active August 29, 2015 14:22
Grep recursively
# Ex.1
find ./ -type f -print | xargs grep 'foo' *
# Ex.2
grep -r 'foo' .
var arr = [
{
name: 'たなか',
sex: '男',
age: 15
},
{
name: 'さとう',
sex: '女',
age: 20
@TomckySan
TomckySan / vimrc
Last active August 29, 2015 14:16
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/