Skip to content

Instantly share code, notes, and snippets.

View leaysgur's full-sized avatar
🫖

Yuji Sugiura leaysgur

🫖
View GitHub Profile
@leaysgur
leaysgur / 1-main.js
Last active June 12, 2018 15:37
passwordless auth0 with amazon cognito
// const auth0 = require('auth0-js');
const webAuth = new auth0.WebAuth({
domain: '<YOUR_DOMAIN>',
clientID: '<YOUR_CLIENT_ID>',
});
@leaysgur
leaysgur / Dockerfile
Last active April 6, 2017 02:56
Docker image for node 6.x latest and yarn and karma w/ headless chrome
# yarn included
FROM node:6
# for installing chrome
RUN apt-get update -qqy \
&& apt-get -qqy install \
apt-transport-https \
ca-certificates \
ttf-wqy-zenhei \
ttf-unfonts-core \
@leaysgur
leaysgur / base.js
Created April 14, 2017 05:24
Simple counter w/ mobx || redux
const [ $rCount, $mCount ] = document.querySelectorAll('span');
const [
$rDecl, $rIncl, $rRand,
$mDecl, $mIncl, $mRand
] = document.querySelectorAll('button');
const fetchRand = function() {
return new Promise(resolve => {
const a = (Math.random()*10|0) + 1;
const b = (Math.random()*10|0) + 1;
@leaysgur
leaysgur / index.ios.js
Last active May 22, 2020 15:21
getUserMedia() w/ React Native WebRTC
// @flow
import React, { Component } from 'react';
import {
AppRegistry,
Button,
StyleSheet,
Text,
View
} from 'react-native';
import {
@leaysgur
leaysgur / index.html
Created May 9, 2017 00:44
How to set height of iframe on iOS
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>How to set height of iframe on iOS</title>
</head>
<body>
<header>header</header>
@leaysgur
leaysgur / base.js
Last active June 20, 2017 08:38
iframe embed video player
window.handleMsg = function(ev, handler) {
// 同一ページ内イベントのみ受ける
if (ev.origin !== location.origin) { return; }
const { type, data } = JSON.parse(ev.data);
// そんなの待ち受けてないので無視
if (type in handler === false) { return; }
handler[type].call(handler, data);
navigator.mediaDevices.getUserMedia({
video: {
width: 100,
}
})
.then(stream => {
const $v = document.createElement('video');
$v.srcObject = stream;
$v.play();
document.body.append($v);
@leaysgur
leaysgur / caller.vue
Created September 1, 2017 00:14
Vueコンポーネントでstaticなプロパティ
<template>
<Component
@changeType="onChangeType"
></Component>
</template>
<script>
import Component from './static-props';
export default {
methods: {
@leaysgur
leaysgur / gUMOpt.js
Created September 13, 2017 02:12
Google MeetのgetUserMedia()の指定
{
audio: {
advanced: [{
deviceId: {
exact: ["default"]
}
}, {
googEchoCancellation: {
exact: true
}
@leaysgur
leaysgur / kv.ex
Last active December 19, 2017 10:00
Minimal KVS implementation using `GenServer` in Elixir
defmodule Kv do
@name :kvs
def new() do
GenServer.start_link(Kv.Server, %{}, name: @name)
end
def lookup(name) do
GenServer.call(@name, {:lookup, name})
end