View text-detection.html
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> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Text Detection using the Shape Detection API</title> | |
<style> | |
body { | |
margin: 0 4px; | |
font-family: sans-serif; |
View barcode-detection.html
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> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Baracode Detection using the Shape Detection API</title> | |
<style> | |
body { | |
margin: 0 4px; | |
font-family: sans-serif; |
View face-detection.html
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> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Face Detection using the Shape Detection API</title> | |
<style> | |
body { | |
margin: 0; | |
font-family: sans-serif; |
View lerna.txt
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
1) Initialise lerna | |
> lerna init | |
2) Create packages | |
> cd packages && mkdir package1 && cd package1 && yarn init -y | |
or | |
> lerna create package1 -y // This would scaffold a package directory | |
3) Add dependencies | |
> lerna add package2 // Installs dependency to all packages except package2 | |
> lerna add package2 --scope=package1 // Installs package2 only to package1 | |
> yarn add package2 // Installs global(top-level) dependency |
View html-to-canvas.js
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
const data = ` | |
<svg xmlns="http://www.w3.org/2000/svg"> | |
<foreignObject width="100%" height="100%"> | |
<div xmlns="http://www.w3.org/1999/xhtml" style="border: 2px solid red; padding: 20px;"> | |
<span style="font-size: 22px;">This will be rendered on the canvas.</span> | |
</div> | |
</foreignObject> | |
</svg> | |
`; | |
const svg = new Blob([data], { type: 'image/svg+xml;charset=utf-8' }); |
View react-image-appear-demo.js
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'; | |
import ReactImageAppear from 'react-image-appear'; | |
class MyComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( |
View app.js
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
var express = require('express'); | |
var app = express(); | |
var woodlotCustomLogger = require('woodlot').customLogger; | |
var woodlot = new woodlotCustomLogger({ | |
streams: ['./logs/custom.log'], | |
stdout: false, | |
format: { | |
type: 'json', | |
options: { |
View app.js
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
var express = require('express'); | |
var app = express(); | |
var woodlot = require('woodlot').middlewareLogger; | |
app.use(woodlot({ | |
streams: ['./logs/app.log'], | |
stdout: false, | |
routes: { | |
whitelist: ['/api', '/dashboard'], | |
strictChecking: false |
View app.js
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
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
View amd-medium-parent-state-update-2.jsx
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
// DeeplyNestedChild.jsx | |
class DeeplyNestedChild extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
updateTopMostParent() { | |
// Call this method with the state value to update | |
window.updateTopMostParent(someValue); | |
} | |
render() { |
NewerOlder