Skip to content

Instantly share code, notes, and snippets.

View tai2's full-sized avatar
🐢

Taiju Muto tai2

🐢
View GitHub Profile
@tai2
tai2 / zaiko.md
Last active September 18, 2017 04:08
在庫2017.9.18

冷凍以外

  • キウイ
  • バナナ一本
  • たまねぎ
  • キャベツ(1/4)
  • にんじん(1本)
  • しょうが
  • 納豆
  • トマト2個
@tai2
tai2 / kondate.md
Last active September 18, 2017 03:53
献立2017.09.11

朝食材

  • やさいパン(半分)
  • スクランブルエッグ(+野菜)
  • パンケーキ(+野菜)
  • ハッシュドポテト
  • グリーンピース
  • 納豆ごはん
  • 冷凍焼きおにぎり
  • しゃけフレークおにぎり
@tai2
tai2 / keyCaseTansform.js
Last active August 28, 2017 16:25
snakeCaseKeys and camelCaseKeys
function snakeCaseKeys(obj) {
const tr = obj => _.transform(obj, (result, value, key) => {
result[_.snakeCase(key)] = _.isPlainObject(value) ? tr(value) : value
});
return tr(obj);
}
function camelCaseKeys(obj) {
const tr = obj => _.transform(obj, (result, value, key) => {
result[_.camelCase(key)] = _.isPlainObject(value) ? tr(value) : value
-- this can be compiled
neverText : Html Never
neverText = text "never dispatch message"
-- this can not be compiled
htmlNever : Html msg -> Html Never
htmlNever elem = elem
@tai2
tai2 / draganddrop.html
Created July 26, 2017 08:02
mouseleave is not fired while dragging
<html>
<head>
<style>
.parent {
width: 300px;
height: 300px;
background: black;
padding: 100px;
}
.draggable {
module App exposing (..)
import Html exposing (Html, div, text, program)
-- MODEL
type alias Model =
String
module Hello exposing (..)
import Html exposing (text)
import List exposing (take, drop, head)
indexOf : a -> List a -> Int
indexOf target list =
let
f target n list =
// Aはpropsで装飾用のコンポーネントを受け取りたい
// ただし、装飾用のコンポーネントが必要とするpropsについては関知したくない
function A(props) {
const Decorator = props.decorator;
return (
<div>
<Decorator {...props.decoratorProps}>TEST</Decorator>
</div>
);
}
@tai2
tai2 / decoration.jsx
Last active July 15, 2017 12:35
コンポーネントの隙間に装飾用のコンポーネントを差し込みたい
// Aはpropsで装飾用のコンポーネントを受け取りたい
// ただし、装飾用のコンポーネントが必要とするpropsについては関知したくない
function A(props) {
const Decorator = props.decorator;
return (
<div>
<Decorator>TEST</Decorator>
</div>
);
}
@tai2
tai2 / jquery-selectmenu.js
Last active September 11, 2021 11:30
jquery ui select menu vue component
Vue.component('jquery-selectmenu', {
props: ['value'],
template: `<select><slot /></select>`,
mounted: function() {
const emit = value => this.$emit('input', value);
$(this.$el).selectmenu({
change: function(event, data) {
emit(data.item.value);
}
});