Skip to content

Instantly share code, notes, and snippets.

@kitak
kitak / Vagrantfile
Last active January 22, 2019 01:11
ESの素振り
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
/*
export interface GridArray<T> extends Array<T> {
first?(): T;
}
export interface Table<T> {
select(filter: object): GridArray<T>;
}
*/
/*
export interface GridArray<T> extends Array<T> {
first?(): T;
}
export interface Table<T> {
select(filter: object): GridArray<T>;
}
*/
@kitak
kitak / question_promisify.js
Last active January 29, 2018 01:08
question promisify
const readline = require('readline')
const util = require('util')
const rl = readline.createInterface({input: process.stdin, output: process.stdout})
rl.question[util.promisify.custom] = (arg) => {
return new Promise((resolve) => {
rl.question(arg, resolve);
});
};
const questionPromise = util.promisify(rl.question);
questionPromise('What do you think of Node.js? ').then((answer) => {
class Checker {
start() {
if (this.checked) {
this.stop();
}
this.checked = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
var Item = Vue.extend({
data: function () {
return {
id: 0,
message: ''
};
},
template: '<li :data-id="id">{{ message }}</li>'
});
@kitak
kitak / index.html
Created December 19, 2016 10:01
Vueの算出プロパティの検証
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="node_modules/vue/dist/vue.js"></script>
<script>
var vm;
document.addEventListener('DOMContentLoaded', () => {
vm = new Vue({
@kitak
kitak / index.vue
Last active December 13, 2016 00:57
<template>
<div>
<div class="card p-1" v-for="nippo in nippoes">
<h3 class="card-title">{{ toJpDate(nippo.created_at) }}</h3>
<p class="card-text">{{ nippo.content }}</p> <router-link :to="{ name: 'edit', params: { id: nippo.id } }" class="btn btn-info">編集</router-link>
</div>
</div>
</template>
<script>
@kitak
kitak / init.lua
Created November 27, 2016 23:11
hammerspoon config
local function keyCode(key, modifiers)
modifiers = modifiers or {}
return function()
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post()
hs.timer.usleep(1000)
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post()
end
end
local function keyCodeSet(keys)
@kitak
kitak / example.js
Created November 1, 2016 06:02
サロゲートペアの文字を扱う
String.fromCodePoint(parseInt("1f376", 16))
String.fromCodePoint(0x1F376)
// "🍶"
Array.from("🍶🍣")
// ["🍶", "🍣"]
"🍶".codePointAt(0).toString(16)
// "1f376"