Skip to content

Instantly share code, notes, and snippets.

Avatar

Keisuke KITA kitak

View GitHub Profile
@kitak
kitak / Vagrantfile
Last active Jan 22, 2019
ESの素振り
View Vagrantfile
# -*- 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
View hoge.ts
/*
export interface GridArray<T> extends Array<T> {
first?(): T;
}
export interface Table<T> {
select(filter: object): GridArray<T>;
}
*/
View hoge.ts
/*
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 Jan 29, 2018
question promisify
View question_promisify.js
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) => {
View promise_test.js
class Checker {
start() {
if (this.checked) {
this.stop();
}
this.checked = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
View app.js
var Item = Vue.extend({
data: function () {
return {
id: 0,
message: ''
};
},
template: '<li :data-id="id">{{ message }}</li>'
});
@kitak
kitak / index.html
Created Dec 19, 2016
Vueの算出プロパティの検証
View index.html
<!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({
View index.vue
<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 Nov 27, 2016
hammerspoon config
View init.lua
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 Nov 1, 2016
サロゲートペアの文字を扱う
View example.js
String.fromCodePoint(parseInt("1f376", 16))
String.fromCodePoint(0x1F376)
// "🍶"
Array.from("🍶🍣")
// ["🍶", "🍣"]
"🍶".codePointAt(0).toString(16)
// "1f376"
You can’t perform that action at this time.