Skip to content

Instantly share code, notes, and snippets.

@liondancer
liondancer / App.js
Created Aug 15, 2017 — forked from mikecrittenden/App.js
Using Google API (gapi) with React
View App.js
/* global gapi */
const API_KEY = 'YOURAPIKEYHERE';
import React, { Component } from 'react';
class App extends Component {
loadYoutubeApi() {
const script = document.createElement("script");
View server.js
import express from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import path from 'path';
import config from '../../webpack.config.dev';
import open from 'open';
/* eslint-disable no-console */
const port = 3000;
View webpack.config.dev.js
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
export default {
entry: [
'./app/index'
],
devtool: 'inline-source-map',
View index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Jifts</title>
</head>
<body>
<div id="app"></div>
<script src="./dist/bundle.js"></script>
</body>
</html>
View server.js
import express from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import path from 'path';
import config from '../../webpack.config.dev';
import open from 'open';
/* eslint-disable no-console */
const port = 3000;
View gist:a8209ffb7e1c28d17a448af88585f763
import express from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import path from 'path';
import config from '../../webpack.config.dev';
import open from 'open';
/* eslint-disable no-console */
const port = 3000;
View test.js
const func = () => {
if (condition) {
return asyncCall().then(() => {
if (condition) {
if (condition) {
// continue looping
return func();
} else {
console.log('some logic');
}
View test.js
const func = () => {
if (condition) {
return asyncCall().then(() => {
if (condition) {
if (condition) {
// continue looping
return func();
} else {
console.log('some logic');
}
@liondancer
liondancer / test.js
Created Jan 31, 2017
Nested while loop skeleton
View test.js
const func = () => {
if (condition) {
return asyncCall().then(() => {
if (condition) {
if (condition) {
// continue looping
return func();
} else {
console.log('some logic');
}
View tests.js
const outerFunc = () => {
var i = 0
return new Promise(resolve => {
if (i < 3) {
i++
const innerFunc = () => {
return new Promise(resolve => {
return log.asyncCall().then(log => {
if (log) {
// some logic