This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (file, api, options) => { | |
const j = api.jscodeshift; | |
const root = j(file.source); | |
const getBodyStatement = fn => { | |
if ( | |
fn.body.type == 'BlockStatement' && | |
fn.body.body.length == 1 | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (file, api, options) => { | |
const j = api.jscodeshift; | |
const root = j(file.source); | |
const createArrowFunctionExpression = fn => { | |
return j.arrowFunctionExpression( | |
fn.params, | |
fn.body, | |
false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VideoCapturer capturer = VideoCapturer.create(""); | |
MediaStream mediaStream = peerConnectionFactory.createLocalMediaStream("APPEAR"); | |
VideoSource videoSource = this.peerConnectionFactory.createVideoSource(capturer, new MediaConstraints()); | |
VideoTrack videoTrack = this.peerConnectionFactory.createVideoTrack("APPEARv0", videoSource); | |
videoTrack.addRenderer(new VideoRenderer()); | |
mediaStream.addTrack(videoTrack); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following is a thought experiment of how it COULD work | |
// todos-template.js | |
export default (todos) => { | |
return ` | |
<div class="todo-wrapper"> | |
<p>Remaining: ${ todos.length }</p> | |
<ul class="todos"> | |
${ todos.map(todo => `<li class="${ todo.completed }">${ todo.text }</li>`) } | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes | |
class Monster { | |
// A method named "constructor" defines the class’s constructor function. | |
constructor(name, health) { | |
// public name object | |
this.name = name; | |
// private name object | |
this[pHealth] = health; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>SystemJS</title> | |
</head> | |
<body> | |
<script src="jspm_packages/system.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
class Hello { | |
render() { | |
return React.createElement("div", null, "Hello ", this.props.name); | |
} | |
} | |
Hello.prototype.displayName = "Hello"; | |
var HelloElement = React.createClass(Hello.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run inside Chrome DevTools to mass hide events matching eventName | |
var removeEvents = function (eventName) { | |
h3s = document.querySelectorAll("div.section h3"); | |
var rtcElems = []; | |
for (var i = 0; i < h3s.length; i++) { | |
var h3 = h3s[i]; | |
if (h3.innerHTML.indexOf(eventName) !== -1) { | |
rtcElems.push(h3.parentElement); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head><title>getUserMedia</title></head> | |
<body> | |
<video autoplay></video> | |
<canvas></canvas> | |
<button>Click me</button> | |
<img src="" alt="captured image from webcam"> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype off | |
call pathogen#infect() | |
call pathogen#helptags() | |
syntax on | |
filetype plugin indent on | |
set smarttab | |
set shiftwidth=4 | |
set autoindent |