Skip to content

Instantly share code, notes, and snippets.

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

kimihito kimihito

🏠
Working from home
View GitHub Profile
@kimihito
kimihito / _messages.html.haml
Last active March 20, 2019 14:31
Close flash message using Stimulus.js + octicons
// Using https://primer.style/css
- flash.each do |key, value|
.flash-messages{data: { controller: 'flash'}}
.flash{class: "flash-#{key == 'alert' ? 'error' : key}"}
%button.flash-close{data: { action: 'flash#dismiss', target: 'flash.close'}, type: 'button'}
×
= value
@kimihito
kimihito / index.js
Created September 7, 2018 05:39
mozilla/readability を使った本文抽出サンプル
import puppeteer from 'puppeteer'
const Readability = require("readability");
import { JSDOM } from 'jsdom'
const URL = 'url'
(async () => {
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
@kimihito
kimihito / main.js
Last active July 14, 2018 07:41
puppeteerでゆうちょダイレクトから残高情報をスクレイピングする
import Yucho from './yucho';
const yuchoID = process.env.YUCHO_ID
const password = process.env.YUCHO_PASSWORD
const aikotoba = process.env.YUCHO_AIKOTOBA
(async () => {
const yucho = await new Yucho(yuchoID, password, aikotoba)
await yucho.run()
@kimihito
kimihito / kanji_to_int.rb
Last active February 21, 2018 11:01
Okinawarb Mob Programming Practice
require 'test/unit'
class Sample
def self.convert(str)
1 if str == '一'
end
end
class TestSample < Test::Unit::TestCase
def test_one
@kimihito
kimihito / circleci-coverage-slack.sh
Last active July 8, 2017 07:52 — forked from seriwb/circleci-coverage-slack.sh
カバレッジをSlack通知するスクリプト
###
# Post coverage rate to Slack
#
# Usage: bash circleci-coverage-slack.sh [simplecov|cobertura|jacoco]
#
# Required environment variables:
#
# - CIRCLE_TOKEN: project-specific readonly API token (need to access build artifacts for others)
# - SLACK_ENDPOINT: Slack endpoint url
# - COVERAGE_FILE: coverage filename (default: .last_run.json)
@kimihito
kimihito / Dockerfile
Last active March 22, 2016 09:27
Docker images for deploying Heroku to use npm
# cf: https://hub.docker.com/r/heroku/ruby/~/dockerfile/
FROM heroku/cedar:14
RUN mkdir -p /app/user
WORKDIR /app/user
ENV GEM_PATH /app/heroku/ruby/bundle/ruby/2.2.0
ENV GEM_HOME /app/heroku/ruby/bundle/ruby/2.2.0
RUN mkdir -p /app/heroku/ruby/bundle/ruby/2.2.0
<!DOCTYPE html>
<html lang='ja'>
<head>
<meta charset='UTF-8'>
<title>カレーのレシピ</title>
</head>
<body>
<header>
<h1>カレーのレシピ</h1>
<p>誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。</p>
@kimihito
kimihito / deploy.sh
Last active August 29, 2015 14:18
Shell Script for deploying to Heroku
#!/bin/bash
# get current branch name
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
push_heroku_branch()
{
git push -f heroku deploy-to-heroku:master
}
@kimihito
kimihito / soundclound2000-readming.md
Created September 2, 2014 02:39
[WIP]SoundCloud2000を読む

grobie/soundcloud2000を読む。

CLIからSoundCloudを起動するgemのやつ。 ホントは動作を確認してからいろいろやらないといけないんだろうけど、なんかissuesで結構動かすまで大変そうだから単純にコードを追いかけるだけ。

参考にしたいのは

  • メソッドの切り分けの単位 →自分が単純にザラザラ書いてしまうので、参考にしたい
@kimihito
kimihito / scrayping.rb
Last active January 4, 2016 19:29
すいませんすいませんすいませんすいません
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'mechanize'
#お笑いナタリーの芸人プロフィールのページから、芸人の情報を抜き出すスクリプト
#期待するdataの中身
=begin
data =