Skip to content

Instantly share code, notes, and snippets.

View takahi-i's full-sized avatar

Takahiko Ito takahi-i

View GitHub Profile
@johtani
johtani / demo.json
Created June 18, 2020 15:37
Elasticsearch勉強会のデモで利用したDevConsoleのスクリプト
## version 7.9で動作するはずです。 discard_compound_tokenの設定は7.8までは動作しないです(それ以外については動作します。)
DELETE en_synonym_test
PUT en_synonym_test
{
"settings": {
"analysis": {
"analyzer": {
"en_synonym": {
@johtani
johtani / gist:b53e9e241e5b98519fb3ffe12b4164eb
Created October 16, 2019 14:49
ant build-dict with ipadic
~/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji (fix-4056 *$) $ ant clean
Buildfile: /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji/build.xml
clean:
[delete] Deleting directory /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/build/analysis/kuromoji
BUILD SUCCESSFUL
Total time: 0 seconds
~/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji (fix-4056 *$) $ ant build-dict
Buildfile: /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji/build.xml
@mixja
mixja / security.json
Last active June 28, 2020 08:20
AWS IAM Policy for MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:GetAccountPasswordPolicy",
"iam:ListUsers",
@Zodiase
Zodiase / es6-abstract-class-example.js
Last active July 18, 2022 11:03
ES6 Abstract Class Example
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
@so-c
so-c / redpen-conf-mirror-house.xml
Last active July 22, 2016 14:16
RedPenのブログ下書き用設定ファイル。
<redpen-conf lang="ja">
<validators>
<!--Rules on sentence length-->
<validator name="SentenceLength">
<property name="max_len" value="100"/>
</validator>
<validator name="CommaNumber" />
<!--Rules on expressions-->
<validator name="ParagraphNumber"/>
@karronoli
karronoli / redpan_ja.bat
Last active December 6, 2015 09:56
RedPen interface for proofreading paragraph.
@echo off
chcp 65001 >NUL
set JAVA_OPTS=-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF-8
cmd /c %USERPROFILE%\Downloads\redpen-cli-1.2\bin\redpen.bat ^
-c %USERPROFILE%\Downloads\redpen-cli-1.2\conf\redpen-conf-ja.xml %* 2>&1 ^
| findstr /V /R "^$" | findstr /V /C:"[INFO ]"
if ERRORLEVEL 1 (
exit /b 0
) else (
exit /b 1
@yamarten
yamarten / Atom.asc
Last active August 29, 2015 14:17
Atom のススメ

Atom のススメ

エディタの方。個人的結論としては「かなり良いけど乗り換えるならもう少し(1.0くらいまで)待ってからでもいいんじゃないか」という感じになると思う。

公式ドキュメントが整備された記念にgistの試し書きも兼ねて書きなぐり。ちなみにこれ自体もAtom で Gist It とか Asciidoc Preview とか使って書いてる。
比較対象は Sublime TextBrackets は特化型っぽいし Light Table はまだ実用的に感じない(Eve 含め少し気になってはいる)。宗教系はもう必要時以外は触れたくない。

気に入ってるところ

  • 拡張性

@floer32
floer32 / python_bind_function_as_method.py
Created February 11, 2015 01:42
Bind Python function as method
# based on: http://stackoverflow.com/questions/1015307/python-bind-an-unbound-method#comment8431145_1015405
def bind(instance, func, as_name):
""" Turn a function to a bound method on an instance
.. doctest::
>>> class Foo(object):
... def __init__(self, x, y):
... self.x = x
... self.y = y
@clintongormley
clintongormley / load_test_data.sh
Last active January 5, 2024 07:32
Run these commands in your shell to setup the test data for Chapter 5
curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d '
{
"email" : "john@smith.com",
"name" : "John Smith",
"username" : "@john"
}
'
curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d '
{
@dfkaye
dfkaye / mocking-private-functions.md
Last active March 13, 2019 15:40
mocking - not testing - private functions in JavaScript, using new Function() - followup to https://gist.github.com/dfkaye/5971486

Mocking - not testing - private functions in JavaScript

Instead of trying to extract a private function, we can rely on mocking/spying. This gist shows how to use the "new Function()" constructor to replace an internal call so that we can mock, spy or stub.

Another response to @philwalton - 
http://philipwalton.com/articles/how-to-unit-test-private-functions-in-javascript/

This is a followup to https://gist.github.com/dfkaye/5971486 - a suggestion for 
*annotating* functions to be extracted and tested separately (publicly).