Skip to content

Instantly share code, notes, and snippets.

View ybiquitous's full-sized avatar
💬

Masafumi Koba ybiquitous

💬
View GitHub Profile
@ybiquitous
ybiquitous / lsp-mode-for-rubocop.el
Last active June 28, 2023 15:08
lsp-mode configuration for RuboCop
(with-eval-after-load 'lsp-mode
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("bundle" "exec" "rubocop" "--lsp"))
:activation-fn (lsp-activate-on "ruby")
:add-on? t
:server-id 'rubocop-ls)))
@ybiquitous
ybiquitous / ruby.yml
Last active June 2, 2022 13:11
Dynamic Ruby versions matrix on GitHub Actions
name: Test
on: push
jobs:
ruby-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.value }}
steps:
@ybiquitous
ybiquitous / index.js
Created March 15, 2022 00:57
PostCSS DeclarationRaws bug reproduction
const postcss = require("postcss");
const src = "a { background: linear-gradient(to right, #fff, #ddd) }";
postcss.parse(src).walkDecls((decl) => {
console.log(decl.raws.value.raw);
});
@ybiquitous
ybiquitous / steep-problem-matcher.json
Created March 9, 2022 23:59
Problem Matcher for Steep
{
"problemMatcher": [
{
"owner": "steep",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+): \\[(.+)\\] (.+)$",
"file": 1,
"line": 2,
"column": 3,
@ybiquitous
ybiquitous / run.sh
Created October 12, 2021 13:31
Install mysql2 gem on M1 mac
brew install openssl
brew install mysql
bundle config set --local build.mysql2 "--with-opt-dir=$(brew --prefix openssl)" "--with-ldflags=-L$(brew --prefix zstd)/lib"
bundle install
@ybiquitous
ybiquitous / update-repository-in-packagejson.sh
Last active August 16, 2021 04:59
Add `repository.directory` field to all `package.json` files
#!/usr/bin/env bash
set -eu -o pipefail
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <repo_url>"
exit 1
fi
url="$1"
files="$(git ls-files | grep package.json)"
@ybiquitous
ybiquitous / actionlint-problem-matcher.json
Last active August 2, 2021 09:58
Run actionlint on GitHub Actions
{
"problemMatcher": [
{
"owner": "actionlint",
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): (.+) \\[(\\S+)\\]$",
"file": 1,
"line": 2,
@ybiquitous
ybiquitous / bump-git.yml
Last active June 29, 2021 15:31
Create pull request to bump git version via GitHub Actions
name: Bump git
on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
env:
target_file: Dockerfile
@ybiquitous
ybiquitous / outdated-dependencies.yml
Last active April 2, 2021 13:05
Update outdated dependencies issue automatically via GitHub Actions
name: Outdated dependencies
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
jobs:
npm:
runs-on: ubuntu-latest
@ybiquitous
ybiquitous / closure-vs-class.js
Created December 22, 2020 02:57
Closure vs Class on JavaScript
// closure
function foo(initial = 0) {
let counter = initial
return {
get counter() { return counter },
increment() { counter += 1 },
}
}
const f1 = foo()
f1.counter //=> 0