Skip to content

Instantly share code, notes, and snippets.

View himanoa's full-sized avatar
🏠
Focusing uzi

himanoa himanoa

🏠
Focusing uzi
View GitHub Profile
@uupaa
uupaa / chrome.extension.send.message.md
Last active August 7, 2022 08:28
Chrome Extension send message

Chrome Extension の Messaging 機能でハマったのでメモ

content script から event page(background script) にメッセージを送る方法

content ▶ event page の方向で送る場合は、tab id が不要

// content script
function send() {
@gaogao-9
gaogao-9 / mpyw.md
Last active June 1, 2023 03:59
mpyw語録
@bfredl
bfredl / nvim-terminal-edit.py
Last active March 1, 2024 01:02 — forked from tarruda/nvim-terminal-edit.py
Edit file in host Neovim instance from a :terminal buffer
#!/usr/bin/env python
"""Edit a file in the host nvim instance."""
from __future__ import print_function
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
@mono0926
mono0926 / commit_message_example.md
Last active March 29, 2024 03:40
[転載] gitにおけるコミットログ/メッセージ例文集100
@chitoku-k
chitoku-k / call-neovim-from-shell.sh
Last active May 5, 2017 18:13
Call Neovim from shell script
python3<<<"import neovim; neovim.attach('socket', path='$NVIM_LISTEN_ADDRESS').input('<C-\\><C-n>')"
@kb10uy
kb10uy / mpywd.c
Created September 19, 2017 08:25
mpywd - Homo Redirect FCGI
/* compile: gcc -o mpywd -lfcgi mpywd.c */
#include <stdio.h>
#include <fcgi_config.h>
#include <fcgi_stdio.h>
int main(void) {
while (FCGI_Accept() >= 0) {
printf("Content-Type: text/html\n");
printf("Status: 302 Found\n");
printf("Location: https://twitter.com/mpyw\n");
@qnighy
qnighy / rust-patterns.md
Last active March 20, 2024 03:33
Rustのパターンっぽいやつメモ

パターンとはその言語が抽象化できなかった敗北の歴史である。 しかしどんなに優れた言語であってもあらゆる繰り返しに勝てるわけではない。 人は必ずメタ繰り返しを欲するからだ。 そしてそれはRustも例外ではない。

ここでは、OOPでも知られているパターンよりも、Rustに特有のパターンを思いつく限りまとめてみた。名前は適当。

  • crate splitting
    • でかいcrateを分割して、見通しを良くする・再コンパイルの分量を削減する・並列コンパイルを可能にする
  • 親玉crate(全てにdependする)と殿crate(全てにdependされる)があることが多いので、だいたい束みたいな形になる。
// To parse this data:
//
// import { Convert, Coordinate } from "./file";
//
// const coordinate = Convert.toCoordinate(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
/**
@uneco
uneco / amazon-dogs.md
Created September 29, 2019 23:34
Amazon.com の 404 ページに表示される犬の一覧

@rosylilly
rosylilly / application_record.rb
Created January 15, 2020 09:39
Useful application record snippet for rails application
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
# List all model classes
def self.models
@models ||= begin
models = []
Rails.root.join('app', 'models').glob('**/*.rb') do |path|