Skip to content

Instantly share code, notes, and snippets.

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

ka kaosf

🏠
Working from home
View GitHub Profile
@kaosf
kaosf / stylesheet-dark.scss
Created June 10, 2022 13:46
Spectre.css very simple dark theme
$primary-color: #7775f9;
$dark-color: #aaa;
$light-color: #303742;
@import "node_modules/spectre.css/src/spectre";
// https://github.com/picturepan2/spectre/issues/629#issuecomment-641715020
@kaosf
kaosf / fork_with_new_connection.rb
Last active May 19, 2022 07:23 — forked from danieldbower/fork_with_new_connection.rb
Forking Processes In Ruby On Rails
# Logic for forking connections
# The forked process does not have access to static vars as far as I can discern, so I've done some stuff to check if the op threw an exception.
def fork_with_new_connection
# Store the ActiveRecord connection information
config = ActiveRecord::Base.remove_connection
pid = fork do
# tracking if the op failed for the Process exit
success = true

tsunagu練習NOTE

動かし方

どこかのEC2なりVPSなり固定IPがあるところでserverを以下のように起動.

docker run --rm -p 18080:8080 -e TSUNAGU_TOKEN=token ghcr.io/making/tsunagu-server
@kaosf
kaosf / tsconfig.json
Created November 22, 2020 07:39
My initial tsconfig.json on 2020-11-22
{
"compilerOptions": {
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"lib": ["es6", "dom"],
"module": "es6",
"moduleResolution": "node",
@kaosf
kaosf / a.md
Last active June 5, 2020 17:14
Vim vim-prettier default arrow-parens trailing-comma different

Change some options for :Prettier, :PrettierAsync commands on Vim to be same to the normal yarn prettier file.js --write command's or VSCode plugin of prettier-vscode's prettier result.

Add the following configurations to your .vimrc.

let g:prettier#config#arrow_parens = 'always'
let g:prettier#config#trailing_comma = 'es5'

References

@kaosf
kaosf / a.md
Last active January 16, 2020 15:03
プログラミングでつまづいてきたこと
@kaosf
kaosf / 1 what-to-do-to-run-xmodmap-cmd-on-bt-kbd-reconnecting.sh
Last active November 24, 2022 17:14
How to run "xmodmap" command when a Bluetooth keyboard is reconnected.
# Check your Bluetooth keyboard MAC Address by
sudo bluetoothctl devices
# Prepare .xmodmap file.
# It crashes "xmodmap $HOME/.xmodmap" command when there is no Caps_Lock keysym.
# Prepare a script file of "reconnect.sh", and change the MAC address placeholder and some commands in it.
# Run this command.
sudo btmon | bash reconnect.sh
#include "stdio.h"
int main(int argc, char const* argv[])
{
int array[] = { 0, 10, 20, 30, 40 };
for (int i = 0; i < 5; i++) {
printf("%d\n", i[array]);
}
@kaosf
kaosf / karabiner-henkan-to-ctrl-space.json
Created August 22, 2018 03:43
Modify "Henkan" key to "Ctrl-Space" (for "before input source") on Mac High Sierra with Karabiner
{
"title": "Henkan to Ctrl-Space",
"rules": [
{
"description": "Henkan to Ctrl-Space",
"manipulators": [
{
"type": "basic",
"description": "Henkan to Ctrl-Space",
"from": { "key_code": "japanese_pc_xfer" },
@kaosf
kaosf / ipp-anitv-parse.rb
Created November 8, 2017 07:45
Idol time PriPara ani.tv URL parser
url_common = 'https://ch.ani.tv'
url = url_common + '/titles/353' # 353 is ipp ID
require 'open-uri'
html = open(url).read
require 'nokogiri'
doc = Nokogiri::HTML.parse html
# latest only
#puts url_common + doc.xpath('//*[@id="title-detail"]/div[1]/div[3]/div/a').attribute('href')
# 1, 2, 3, ... latest
doc.xpath('//*[@id="title-detail"]/div[1]/div[4]/div/a').each do |e|