Skip to content

Instantly share code, notes, and snippets.

View mmizutani's full-sized avatar

Minoru Mizutani mmizutani

  • Tokyo
  • 13:14 (UTC +09:00)
View GitHub Profile
@mala
mala / a.md
Last active June 30, 2020 15:13
Chrome ExtensionのLive HTTP Headersの調査(CoolBar.Pro導入 Extensionが何を行うかの調査)

Chrome ExtensionのLive HTTP Headersを調査した。Firefox用のものではない。Firefox用のものではない。

11/7追記

English version: https://translate.google.com/translate?sl=ja&tl=en&js=y&prev=_t&hl=ja&ie=UTF-8&u=https%3A%2F%2Fgist.github.com%2Fmala%2Fe87973df5029d96c9269d9431fcef5cb&edit-text=&act=url

Summary in english.

@Arakaki-Yuji
Arakaki-Yuji / gist:766cc54ed18ba859881a
Last active July 11, 2020 10:18
RailsのActiveRecordで親要素から孫要素を参照する場合
#
# includesでentriesとそれに紐づくcommentsをロードしておく。
# そうすることで以後の処理でentriesとそれに紐づくcommentsを取得するさいに
# 毎回SQLを発行することを防ぐ。
#
# includesのかわりにjoinsを使うと事前ロードはされないため、
# 以後の処理でSQLが吐かれてしまうので注意する。
#
blog = Blog.includes(:entries => :comments).find_by_id(1)
@zblz
zblz / mlflow_plugin_system_proposal.md
Last active August 17, 2020 09:13
Proposal for plugin system in MLflow

Proposal for a plugin system in MLflow

Motivation

MLflow has an internally pluggable architecture to enable using different backends for both the tracking store and the artifact store. This makes it easy to add new backends in the mlflow package, but does not allow for other packages to provide new handlers for new backends.

This would be useful for several reasons:

@ziaulrehman40
ziaulrehman40 / CircleCI 2.0 Parallel builds SimpleCov coverage report merging locally overview.md
Last active August 30, 2020 15:10
CircleCI 2.0 Parallel builds SimpleCov coverage report merging locally

Simplecov aggregated coverage report from CircleCI 2.0 parallel builds (focused on storing locally/within CI containers as artifacts)

Problem Statement

We have Rails application which is running tests on circleCI 2.0, we have simplecov configured to track the coverage of our test suite. Now the problem is with parallelism enabled, we have partial coverage reports in all different containers according to the tests those containers ran.

We obviously want to have consolidated simplecov coverage report which actually shows us overall coverage report.

@digitaljhelms
digitaljhelms / gist:5247192
Last active September 17, 2020 11:01
A faster, less buggy alternative to "python -m SimpleHTTPServer"
$ npm install -g http-server
$ http-server -p 8000 -a foo.bar.com

Would serve PWD at http://foo.bar.com/

@nateware
nateware / nginx.conf
Last active November 23, 2021 10:54
Nginx sample config for EC2
#
# Sample nginx.conf optimized for EC2 c1.medium to xlarge instances.
# Also look at the haproxy.conf file for how the backend is balanced.
#
user "nginx" "nginx";
worker_processes 10;
error_log /var/log/nginx_error.log info;
@cpylua
cpylua / datediff.c
Created April 22, 2012 14:19
computing the day difference between two dates
/* this code is from http://c-faq.com/lib/calendar.br.html */
#define DayOfWeek(d,m,y) (int)(DaysElapsed(d,m,y) % 7)
long DaysElapsed(int d,int m,int y) {
static int cd[]={0,31,59,90,120,151,181,212,243,273,304,334};
long n=365L*(y-1);
if (m<3) y--;
return n+y/4-y/100+y/400+cd[m-1]+d;
@myitcv
myitcv / sexp_exp.rb
Last active March 5, 2022 13:30
Ruby parsing stuff
require 'ripper'
require 'pp'
exp = ARGV.join(" ")
p Ripper.sexp(exp)
@TylerRick
TylerRick / detailed_hash_diff.rb
Last active July 22, 2022 18:25 — forked from fabriciofreitag/detailed_hash_diff.rb
Custom RSPec matcher for detailed hash compasion and diff
require 'facets/hash/recurse'
# Usage:
# expect(actual).to match_hash(expected)
#
RSpec::Matchers.define :match_hash do |expected|
match do |actual|
# Sort hashes before comparing so that the diff only shows actual changes between keys and
# values.
actual = actual.recurse {|h| h.sort_by {|k,v| k.to_s }.to_h }
@yusukebe
yusukebe / client.ts
Last active December 10, 2022 00:52
import { Client } from '../../../src/middleware/client'
import type { AppType } from './server'
const client = new Client<AppType>('http://127.0.0.1:8787/api')
const res = await client.json('/posts', {
id: 123,
title: 'hello',
})