Mix.install([
{:req, "~> 0.3"},
{:jason, "~> 1.4.0"},
{:kino, "~> 0.9.1"}
])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "boot" | |
require "rails/all" | |
# Require the gems listed in Gemfile, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(*Rails.groups) | |
module YourApp | |
class Application < Rails::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco-docker-compose () { | |
local selected_dir=$(ghq list --full-path | while read repo; do [ -f "${repo}/docker-compose.yml" ] && echo "$repo"; done | peco --query "$LBUFFER") | |
if [ -n "$selected_dir" ]; then | |
docker-compose --file "${selected_dir}/docker-compose.yml" --project-name "$(basename $selected_dir)" $* | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AxiosResponse } from 'axios'; | |
import contentType = require('content-type'); | |
import cheerio = require('cheerio'); | |
type Charset = string; | |
type IntermediateResult = Charset | null; | |
// to assert elements as tuple (inferred Array<string | Buffer>) | |
const bomify = ([c, bytes]) => ([c, Buffer.from(bytes)] as [Charset, Buffer]); | |
const BOMS: ReadonlyMap<Charset, Buffer> = new Map([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco-agsed() { | |
ag $1 | sed "s/$1/$1 => $2/g" | peco | awk -F: '{print $2; print $1}' | parallel -N 2 sed -i "''" '"'{1} s/$1/$2/g'"' {2} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SEG_NUMS = %w{3f 06 5b 4f 66 6d 7d 27 7f 6f}.map(&:hex) | |
def candidates(changable_bits, on_bits) | |
# onとchangable_bitsでnをカバーできる && onがはみ出していない | |
SEG_NUMS.select { |n| | |
((on_bits | changable_bits) & n == n) && ((on_bits &~ n) == 0) | |
}.map {|i| SEG_NUMS.index(i) } | |
end | |
# 怪しい |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = require 'lodash' | |
module.exports = ({target, topBarrier, upperBound, bottomBarrier, lowerBound, wait, stickIf})-> | |
getLowerBound = (topBarrier)-> | |
return 0 unless topBarrier | |
topBarrier = topBarrier?() || topBarrier | |
topBarrierRect = topBarrier.getBoundingClientRect() | |
window.scrollY + topBarrierRect.bottom | |
getUpperBound = (bottomBarrier)-> | |
return document.documentElement.getBoundingClientRect().height unless bottomBarrier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DBNAME="$1" | |
export PGPASSWORD="$2" | |
CACHE_FILE="/tmp/pg_gmetric" | |
OLD_CACHE_FILE="$CACHE_FILE.old" | |
pg_query() { | |
_NAME="$1" | |
_COMMAND="$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/kazuho/3300555 | |
// の参照先の切り替えを隠蔽しようと思ったら | |
// ただの愚直な実装になった | |
var generator = function(n, name){ | |
var current = {f: function(){ return name; }}, | |
doNothing = function(){}, | |
o = current; | |
while(--n) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# depends on peco, chrome-cli | |
function peco-chrome-tabs () { | |
local tab_id=$(chrome-cli list tabs | peco | sed -e s/.*:// -e s/].*//) | |
if [ -n "$tab_id" ]; then | |
chrome-cli activate -t $tab_id | |
fi | |
} |
NewerOlder