Skip to content

Instantly share code, notes, and snippets.

@keshihoriuchi
keshihoriuchi / App.tsx
Last active April 11, 2022 17:58
WebRTC on React Hooks and TypeScript
import React, { useEffect, MutableRefObject, useRef, useState } from "react";
import "./App.css";
const VideoRoom: React.FC = () => {
const refSelfMediaStream: MutableRefObject<MediaStream | null> = useRef(null);
const refSelfVideo: MutableRefObject<HTMLVideoElement | null> = useRef(null);
const refPc1: MutableRefObject<RTCPeerConnection> = useRef(
new RTCPeerConnection()
);
const refPc2: MutableRefObject<RTCPeerConnection> = useRef(
@imminent
imminent / activity_example.xml
Last active August 29, 2015 14:12
Workaround to https://code.google.com/p/android/issues/detail?id=60055 caused by paddingStart and paddingEnd on some Samsung devices
<?xml version="1.0" encoding="utf-8"?>
<!-- This goes in layout/ and is an example layout using the workaround. -->
<EditView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/fieldPaddingLeft"
android:paddingRight="@dimen/fieldPaddingRight" />
@parambirs
parambirs / s4di_ch01_exercises.sc
Last active August 14, 2019 23:11
Solutions for "Scala for the Impatient", chapter 1 exercises
package src.exercises
import scala.math._
import BigInt.probablePrime
import util.Random
object chap01 {
// 1. In the Scala REPL, type 3. followed by the Tab key. What methods can be
// applied?
// => Do it in REPL. There are many methods including %, &, *, +, toByte, toChar etc.
@derek-schaefer
derek-schaefer / play.conf
Created June 19, 2013 14:55
A sample Upstart script for managing a Play application. Bypasses the "start" script.
description "Play"
env USER=user
env GROUP=group
env HOME=/opt/yourapp
env JAVA=/usr/bin/java
env JAVA_OPTS="-cp ./staged/* play.core.server.NettyServer ./.."
env PORT=80
env EXTRA="-Xms128M -Xmx512m -server"
@aslakknutsen
aslakknutsen / Asciidoctor.py
Last active December 16, 2015 04:19
Sublime AsciiDoctor Plugin
import re
import sublime
import sublime_plugin
import webbrowser
REG_RENAME = re.compile("\.(asciidoc|adoc|asc|ad)$")
EXT = re.compile(".*\.(asciidoc|adoc|asc|ad)$")
COMMAND = "asciidoctor -b html5"