Skip to content

Instantly share code, notes, and snippets.

View antonybudianto's full-sized avatar

Antony Budianto antonybudianto

View GitHub Profile
<% _.forEach(env, function(v, k) { %>
global.___ENV__['<%= k %>'] = '<%= v %>';
<% }) %>
function hasPairOfSum(arr, sum){
var flag;
for(let i=0;i<arr.length;i++) {
if (flag === arr[i]) { return true; }
else if (arr[i] !== sum/2) { continue; }
else if(!flag) { flag = arr[i]; }
}
return false;
}
function jsonToFirebaseJSON(arr) {
const result = arr.reduce((acummulator, current, index) =>
(Object.assign({}, acummulator, {[index]: current})), {});
return JSON.stringify(result);
}
// index can be replaced with your id/primary key
// you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(A) {
// write your code in JavaScript (Node.js 6.4.0)
let len = A.length
let arr = new Array(len)
for(let i=0; i<len;i++) {
let idx = A[i] - 1
function solution(S) {
const openBrackets = ['(', '{', '['];
const closeBrackets = [')', '}', ']'];
let len = S.length;
let stack = [];
let counter=0;
if (len === 0) { return 1; }
if (len % 2 !== 0) { return 0; }
function solution(A, B) {
// write your code in JavaScript (Node.js 6.4.0)
let len = A.length;
if (len === 1) return 1;
let stack = [];
// stack.unshift(0);
let sum = B.reduce((a,c) => a+c, 0);
if (sum === 0 || sum === len) return len;
if (sum === 1 === B[len-1]) return len;
if (sum === len-1 && B[0] === 0) return len;
// you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(H) {
// write your code in JavaScript (Node.js 6.4.0)
let len = H.length;
if (len === 1) return 1;
let low = 0;
let stack = [];
let tmp = 0, count=0, countB=0;
import React, { Component } from 'react';
import {
BrowserRouter as Router,
Route,
Switch
} from 'react-router-dom';
import './App.css';
import LandingPage from './LandingPage/LandingPage';
import PortfolioPage from './PortfolioPage/PortfolioPage';
import React from 'react';
import ReactDOM from 'react-dom';
import { mount } from 'enzyme';
import { MemoryRouter } from 'react-router';
import LandingPage from './LandingPage/LandingPage';
import NotFoundPage from './ErrorPage/NotFoundPage/NotFoundPage';
import App from './App';
jest.mock('firebase/app');
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "build",
"rewrites": [
{
"source": "**",
"function": "app"