Skip to content

Instantly share code, notes, and snippets.

View marocchino's full-sized avatar
🏠
Working from home (7am~16pm JST)

marocchino

🏠
Working from home (7am~16pm JST)
View GitHub Profile
@marocchino
marocchino / validate-dependabot.sh
Created February 18, 2021 21:56
validate dependabot yaml
#!/bin/bash
set -e
YAML=$(cat "${1:-.github/dependabot.yml}")
YAML="${YAML//$'\n'/\\n}"
YAML="${YAML//\"/\\\"}"
JSON="{\"config-file-body\": \"$YAML\"}"
curl -X "POST" "https://api.dependabot.com/config_files/validate" \
-H 'Host: api.dependabot.com' \
-H 'Referer: https://dependabot.com/docs/config-file/validator/' \
ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)
defmodule CostTest do
use ExUnit.Case
def cost([]), do: 0
def cost([_last]), do: 0
def cost([current | [next | tail]]) do
# frozen_string_literal: true
require 'benchmark/ips'
def fast
[1, 2].min.then { |m| [m, 3].min }
end
def slow
[1, 2, 3].min
@marocchino
marocchino / api.js
Created March 20, 2018 19:59
fetch monitor
someQuery(variables, { commit }) {
client.query(query, variables, { commit })
}
@marocchino
marocchino / 12-04.md
Last active April 20, 2016 03:36
커피스크립트에서 바벨로 옮기기

개발환경 설정하기

http://brew.sh 에 들어가서 Install Homebrew 밑에 명령어을 복사해서 터미널에 붙임.

노드 설치

brew install node
@marocchino
marocchino / bench.rb
Created August 14, 2015 02:56
Array#* vs Array.new
require 'benchmark'
n = 500_000_000_000_000
Benchmark.bm do |x|
x.report { ["a"] * 10 }
x.report { Array.new(10, "a") }
end
# user system total real
# 0.000000 0.000000 0.000000 ( 0.000012)
@marocchino
marocchino / TIL.md
Created March 2, 2015 13:59
fish 에서 RAILS_ENV 사용하기

fish에서 RAILS_ENV하기

이 명령은 fish에서 쓸 수 없다.

$ RAILS_ENV=test rake db:migrate

는 건 알고 있었는데.. 오늘 마침 저걸 할일이 있어서 찾아보았다.