Skip to content

Instantly share code, notes, and snippets.

flutter pub add logger
flutter pub add go_router
flutter pub add freezed_annotation dev:build_runner dev:freezed json_annotation dev:json_serializable
flutter pub add flutter_hooks hooks_riverpod dev:custom_lint dev:riverpod_lint riverpod_annotation dev:build_runner dev:riverpod_generator
flutter pub add firebase_core firebase_auth firebase_auth_ui google_fonts firebase_analytics cloud_firestore
@cooloon
cooloon / GetIntersectionPointCoordinates.cs
Created December 17, 2018 04:30
2直線の交点を求める
/// <summary>
/// Gets the coordinates of the intersection point of two lines.
/// </summary>
/// <param name="A1">A point on the first line.</param>
/// <param name="A2">Another point on the first line.</param>
/// <param name="B1">A point on the second line.</param>
/// <param name="B2">Another point on the second line.</param>
/// <param name="found">Is set to false of there are no solution. true otherwise.</param>
/// <returns>The intersection point coordinates. Returns Vector2.zero if there is no solution.</returns>
public Vector2 GetIntersectionPointCoordinates(Vector2 A1, Vector2 A2, Vector2 B1, Vector2 B2, out bool found)
@cooloon
cooloon / Test.cs
Created July 11, 2018 03:40
[Unity] Pause and Resume coroutine
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour
{
IEnumerator _routine;
IEnumerator routine { get { return _routine ?? (_routine = RoutineImpl()); } }
void OnEnable()
{
@cooloon
cooloon / count_lines.sh
Created December 8, 2016 09:51
実装ファイルの行数を数える
find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.cs" ")" -print0 | xargs -0 wc -l
@cooloon
cooloon / list_kanji_from_text.rb
Last active December 8, 2016 09:51
文章中に使われている漢字の一覧を取得する
TEXT = 'ここに文章を挿入。ここに文章を挿入。'
p TEXT.scan(/\p{Han}/).sort.uniq
@cooloon
cooloon / scrape_daily_used_kanji_from_wikipedia.rb
Last active March 3, 2016 23:49
wikipediaの常用漢字表から現在使われている常用漢字を抜き出す
require 'uri'
require 'open-uri'
require 'Nokogiri'
uri = URI.escape('https://ja.wikipedia.org/wiki/常用漢字一覧')
doc = Nokogiri::HTML(open(uri).read)
arr = []
doc.xpath('/html/body//table[@class="sortable wikitable"][1]/tr').each_with_index do |node,i|
next if i == 0
@cooloon
cooloon / scrape_jukugo.rb
Created March 3, 2016 12:14
文部科学省の常用漢字表から二字熟語を抜き出す
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open('http://www.mext.go.jp/b_menu/hakusho/nc/k19811001001/k19811001001.html'))
all_words = []
doc.xpath("/html/body//div[@class='oldFormat']//table/tr").each do |tr|
line = tr.xpath("./td[3]").text.strip
words = line.split(',')
all_words += words