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 / 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
}
<!DOCTYPE html>
<html lang='ja'>
<head>
<meta charset='UTF-8'>
<title>カレーのレシピ</title>
</head>
<body>
<header>
<h1>カレーのレシピ</h1>
<p>誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。</p>
@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
@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 / 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 / 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 / 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 / _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'}
&times;
= value
@kimihito
kimihito / application.html.haml
Last active April 22, 2019 05:19
twemoji + Stimulus.js
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Idone.today
= csrf_meta_tags
= csp_meta_tag
= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
%body.bg-gray{ data: { controller: 'emoji-parser'} }
@kimihito
kimihito / track_decorator.rb
Created April 22, 2019 13:07
Use autolink twitter-text gem
module TrackDecorator
include Twitter::TwitterText::Autolink
include Rails.application.routes.url_helpers
def body
# https://github.com/twitter/twitter-text/blob/752b9476d5ed00c2ec60d0a6bb3b34bd5b19bcf9/rb/spec/autolinking_spec.rb#L687-L689
html = auto_link_hashtags(raw_body, { :hashtag_url_block => lambda { |url| project_path(self.project) } , hashtag_class: 'Label Label--gray'})
raw html
end
end