Skip to content

Instantly share code, notes, and snippets.

View jerrywdlee's full-sized avatar
:octocat:
Focusing

Julia Lee jerrywdlee

:octocat:
Focusing
View GitHub Profile
@jerrywdlee
jerrywdlee / large_unicode_csv.rb
Created November 20, 2020 15:06
ヘッダーが日本語の巨大CSVを取り込んでみる
# See: https://qiita.com/jerrywdlee/items/b9b15380ac3fe87c68ad
require 'benchmark'
require 'csv'
class LargeUnicodeCsv
class << self
def generate(cnt = 1_000_000)
headers = %w[ID 名前 フリガナ 年齢 血液型 都道府県 携帯キャリア]
exec_benchmark do
CSV.open('dummy_data.csv', 'w', write_headers: true, headers: headers) do |csv|
@jerrywdlee
jerrywdlee / file0.rb
Last active August 10, 2018 10:20
Railsの不特定ModuleやClass(Modelなど)で`_path`を使う ref: https://qiita.com/jerrywdlee/items/f91c9ea01055cb74083c
class Foo
def self.show_path_1
foo_path
end
def show_path_2
foo_path
end
end
@jerrywdlee
jerrywdlee / gist:1dd81755698c81bacc2e68a68a3ed4d6
Created July 27, 2018 01:43 — forked from rosylilly/gist:3401612
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@jerrywdlee
jerrywdlee / log_output.js
Last active June 24, 2018 17:22 — forked from polotek/pipeaccept.js
accepting input from a pipe, nodejs
'use strict';
const limit = 15;
let counter = 0;
const timer = setInterval(() => {
console.log(`Sample Log[${counter + 1}] at ${new Date()}`);
counter ++;
if (counter >= limit) {
clearInterval(timer);
@jerrywdlee
jerrywdlee / genesis_public_key
Created February 8, 2018 15:33
genesis_public_key
04e227baf13fb8312b7a953b49997aaca8b8522288b6349eb05381ad873715e40c670fd5f23ebbc184155acfae93e1ab5a784c898a3b22c44996f69d58b0cc7722 jerrywdlee-kagebunshin
@jerrywdlee
jerrywdlee / gi.sh
Last active December 24, 2017 07:30
gitignore.sh
#!/bin/bash
# Insall:
# curl -L -s https://cdn.rawgit.com/jerrywdlee/7d70e765c56cd151c0c13fb11d1bdb3a/raw/b8df7028d7b317aaae113111d940d4b11d0e5e81/gi.sh > $HOME/.gi.sh
# echo "alias gi=\"bash \$HOME/.gi.sh\"" >> ~/.bash_profile && source ~/.bash_profile
# Usage:
# cd MYAPP && gi node rails
params=`echo $@ | tr ' ' ','`
@jerrywdlee
jerrywdlee / dice_01.js
Created October 20, 2017 14:36
投掷一枚骰子,掷出连续3次点数2在累积得到30次点数5之前的概率
'use strict';
// 知乎问题:投掷一枚骰子,掷出连续3次点数2在累积得到30次点数5之前的概率如何计算?
// https://www.zhihu.com/question/66227357
const _ = require('lodash');
const ROUND = 10;
const TEST_TIMES = [1000 * 10, 1000 * 100, 1000 * 1000, 1000 * 1000 * 10 ];
@jerrywdlee
jerrywdlee / ブランチ名表示.md
Last active July 9, 2017 09:08
MacのGitで補完を効かせたりブランチ名を表示する設定

操作:

mkdir ~/.bash_completion && cd ~/.bash_completion
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > git-completion.bash
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > git-prompt.sh
# Add in ~/.bashrc OR ~/.bash_profile
source ~/.bash_completion/git-prompt.sh
const STR_LEN = 80
const SUSHI_INTERVAL =10
let cnt = 0;
function sushiDraw(){
const sa = new Array(STR_LEN).fill(' ')
for(let i = 0; i < STR_LEN; i += SUSHI_INTERVAL){
const sushiIndex = sa.length - 1 - (cnt + i) % sa.length
sa.splice(sushiIndex, 1, '🍣')
}
@jerrywdlee
jerrywdlee / BBSajax.html
Last active August 29, 2015 14:21
簡易掲示板(Simple BBS)
<!DOCTYPE html>
<html>
<head>
<!-- Include meta tag to ensure proper rendering and touch zooming -->
<meta charset="utf-8" content="width=device-width, initial-scale=0" />
<!-- Include jQuery Mobile stylesheets -->
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/>