Skip to content

Instantly share code, notes, and snippets.

@rike422
rike422 / file0.rb
Last active May 13, 2019 09:52
メール処理用のRuby製botフレームワークを作った(作っている) ref: https://qiita.com/rike422/items/46f02d073faf3b8e5176
require 'slack-ruby-client'
module Rounders
module Handlers
class Invoice < Rounders::Handlers::Handler
# メールをフィルタリングするAND条件、第二引数に渡したSymbolはメソッド名
on({
subject: 'Amazon Web Services Invoice Available',
from: 'aws-receivables-support@email.amazon.com'
@rike422
rike422 / file4.html
Last active April 19, 2019 09:26
シュッとHTMLをJSON化できるライブラリを作った ref: https://qiita.com/rike422/items/9b8a6f9bf16a5cbf5c99
<ul>
<li class="item">item1</li>
<li class="item">item2</li>
<li class="item">item3</li>
</ul>
const yaml = require("js-yaml");
const fs = require("fs");
const path = require("path");
const setting = {};
const CONFIG_DIR = path.join(__dirname, "../", "config");
const ENVIRONMENTS_CONFIG_DIR = path.join(CONFIG_DIR, "settings");
const LOCAL_CONFIG_YAML = path.join(CONFIG_DIR, "settings.local.yml");
const CONFIG_YAML = path.join(CONFIG_DIR, "settings.yml");
@rike422
rike422 / peco_script.sh
Last active July 29, 2016 10:35
自分用pecoスクリプト
# http://k0kubun.hatenablog.com/entry/2014/07/06/033336
# http://qiita.com/wada811/items/78b14181a4de0fd5b497
function peco-select-history() {
typeset tac
if which tac > /dev/null; then
tac=tac
else
tac='tail -r'
fi
@rike422
rike422 / gist:8008335
Created December 17, 2013 16:59
titanium用のgruntfail src配下をapp配下に移す想定
module.exports = function(grunt) {
'use strict';
// Grunt Initialize
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
watch : {
all : {
files : [ 'Resources/**/*.js' ],
tasks : [ 'tishadow:spec' ]
},
ユースケース
* 概要を把握する
** 全体的にそのリストからどのような印象を受けるか考える
* 項目を一見ずつブラウズする必要があるか
* 特定の項目を検索する必要があるか
* ソートやフィルタリングを行う必要があるか?
@rike422
rike422 / gist:7096675
Created October 22, 2013 07:48
casper.js使い方

casper.jsとは

CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS WebKit headless browser and SlimerJS (Gecko). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:

参考資料

コマンド

@rike422
rike422 / gist:5805050
Last active December 18, 2015 15:29
jsでrailsの日付拡張っぽく日付取得するやつ(未テスト)タイムゾーン回り怪しい
Number.prototype.ago = function() {
var result, addSec, gap;
result = new Date();
addSec = this.valueOf() * 86400000;
gap = dt.setTime(Date.now() - addSec);
result.setTime(gap);
return dt;
}
Number.prototype.since = function() {
@rike422
rike422 / gist:5801928
Last active December 18, 2015 15:08
重複検出
function dupulicate(array) {
var storage = {};
var duplicateArray = [];
var i,value;
for ( i=0; i < array.length; i++) {
value = array[i];
if (value in storage) {
duplicateArray.push(value);
} else {
storage[value] = true;
@rike422
rike422 / hubot-train-delay.coffee
Last active October 8, 2015 10:08
電車遅延ゲット
# Description:
# Search and show your train time in Japan
#
# Dependencies:
# "cheerio-httpcli", ""
#
# Configuration:
# None
#
# Commands: