This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TypeScript build | |
FROM node:14-slim | |
WORKDIR /build | |
deps: | |
COPY package.json package-lock.json ./ | |
RUN npm install | |
# Output these back in case npm install changes them. | |
SAVE ARTIFACT package.json AS LOCAL ./package.json | |
SAVE ARTIFACT package-lock.json AS LOCAL ./package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface CollectionSchema { | |
_proto: any | |
path: string | |
sub ?: { | |
[prop: string]: CreateCollection<any> , | |
} | |
} | |
type CreateCollection<T> = (parentPath: string) => Collection<T extends CollectionSchema ? T: never> | |
class Collection<T extends CollectionSchema> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# recordVideoをバックグラウンドで実行 | |
xcrun simctl io booted recordVideo screenshots/test.mov & | |
# プロセスIDを保存 | |
PID=`echo $!` | |
# テスト実行 | |
bundle exec rspec spec/scenario_test.rb | |
# バックグラウンドのrecordVideoにSIGINTシグナルを送信 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# 便利関数 | |
use strict; | |
use warnings; | |
use utf8; | |
use Clone qw(clone); | |
# arrrefをユニークな$keyごとのhashに変換する | |
# arrref_to_hash [{key => 1, foo => bar},{key = 2, foo => hoge}] | |
# >> {1 => {foo => bar}, 2 => {foo => hoge}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" syntasticとvim-quickrunをCartonに対応させるvimec | |
" thinca/vim-localrcをインストールし、Cartonで管理しているAmon2プロジェクトなどのlibがあるディレクトリに.local.vimrcとして置く | |
let carton_path = system('carton exec perl -e "print join(q/,/,@INC)"') | |
let lib_path = fnamemodify(finddir("lib", ";"), ":p") | |
let g:syntastic_perl_lib_path = join([carton_path, lib_path], ',') | |
let g:quickrun_config = { | |
\ 'perl' : { | |
\ 'cmdopt': '-Ilib', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Web Speech API</title> | |
<meta charset="utf-8"> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
</head> | |
<body> | |
<input type="button" value="音声認識開始" onclick="startRecognition();"/> | |
<input type="button" value="音声認識終了" onclick="recognition.stop();"/> | |
連続認識<input id="continuous" type="checkbox"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
""" | |
ChaSenの擬似ラッパー | |
""" | |
import subprocess | |
class UnidicTagger(object): | |
''' | |
MeCabのTaggerライクなChaSenのTagger | |
今のところ unidic+utf-8環境専用 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//phpのサーバーに対してObjective-CからHTTPのPOSTでJSONを送ろうとしているのですがうまくいかないです。 | |
//何か知ってる人がいたら教えてもらえると助かります | |
+ (NSData *)httpPostExpectReturn:(NSData *)json :(NSString *)urlString{ | |
//HTTP POST | |
NSString* encodedUrl = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"http POST url: %@",encodedUrl); | |
//うまくいかないけど本当はこういうJSONを送りたい | |
NSArray *requestDict = @[@{@"key":@"value"},@{@"key":@"value2"}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/nonfree/nonfree.hpp> | |
#include <opencv2/legacy/legacy.hpp> //BruteForceMatcheに必要。opencv2.4で移動した? | |
int main(int argc, char *argv[]) | |
{ | |
//画像読み込み | |
cv::Mat colorImg1 = cv::imread("box1.jpg"); | |
cv::Mat colorImg2 = cv::imread("box3.jpg"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
''' | |
単純なSuffixArrayの実装 | |
部分文字列の検索 | |
Ngram数え上げ | |
''' | |
def multikeysort(string, indices, cmpindex=0): | |
"""単純なマルチキークイックソート | |
文字列のインデックスを使用したソート""" | |
if not indices: |