Skip to content

Instantly share code, notes, and snippets.

View odiak's full-sized avatar

Kaido Iwamoto odiak

View GitHub Profile
import numpy as np
from dataclasses import dataclass
@dataclass(frozen=True)
class Adam:
learning_rate: float = 1.0
eps: float = 1e-8
rho1: float = 0.9
rho2: float = 0.999
function f1(...args: number[] & {0: any}) {
}
f1() // type error!
f1(1)
f1(1, 2, 3)
const a1: number[] = [1, 2, 3]
const a2: number[] = []
f1(...a1) // type error! (unexpected)
'atom-text-editor':
'ctrl-t': 'fuzzy-finder:toggle-file-finder'
'atom-text-editor.vim-mode-plus.insert-mode':
'ctrl-h': 'core:backspace'
# 'atom-text-editor.vim-mode-plus.insert-mode.autocomplete-active':
# 'escape': 'autocomplete-plus:cancel'
'body atom-text-editor.autocomplete-active':
'up': 'autocomplete-plus:move-up'
'down': 'autocomplete-plus:move-down'
'ctrl-p': 'autocomplete-plus:move-up'
use strict;
use warnings;
use 5.010;
use DBIx::MyParsePP;
my %TYPES = (
DECIMAL_SYM => 3,
INT_SYM => 4,
BIGINT => 4,
SMALLINT => 4,
@odiak
odiak / build.gradle
Created July 12, 2017 13:31
for ktor
buildscript {
ext.kotlin_version = '1.1.0'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
import kotlin.reflect.KClass
import kotlin.reflect.full.memberProperties
open class A {
val a = "xxxx"
var b = 12
}
class B : A() {
val c: String? = null
sealed class Either<out L, out R> {
class Left<out T>(val value: T) : Either<T, Nothing>() {
override fun equals(other: Any?): Boolean =
other is Left<*> && other.value == value
override fun hashCode(): Int = value?.hashCode() ?: 0
override fun toString(): String = "Left($value)"
}
open class A {
init {
doSomething()
}
open fun doSomething() {
}
}
class B : A() {
open class Value(open val value: Any?) {
open operator fun invoke(v: Value): Value {
throw UnsupportedOperationException("nop!")
}
}
open class Func(v: (Value) -> Value) : Value(v) {
override val value = v
override operator fun invoke(v: Value): Value {
@odiak
odiak / dev-server.js
Created February 23, 2016 08:18
フロントエンド開発時の静的ファイル用サーバー
'use strict';
const http = require('http');
const fs = require('fs');
function respond(req, res, contentType, body) {
let d = new Date();
console.log(`[${d}] ${req.url}`);
res.writeHead(200, {