Skip to content

Instantly share code, notes, and snippets.

View danivijay's full-sized avatar
💙
https://twitter.com/utmostdev

Dani Vijay danivijay

💙
https://twitter.com/utmostdev
View GitHub Profile
package com.google.challenges;
public class Answer {
public static int answer(int[] l) {
// Your code goes here.
}
}
package com.google.challenges;
public class Answer {
public static int locate(int head, int target, int under) {
under /= 2;
int right = head - 1; // right = head - 1
int left = head - 1 - under--; // left = head - 1 - under/2
if (right == target || left == target)
@danivijay
danivijay / package.json
Last active December 16, 2017 12:16
package.json for Building a JS Development Environment, install 'npm-run-all' first.
{
"name": "javascript-development-environment",
"version": "1.0.0",
"description": "JavaScript Development Environment by Dani Vijay",
"scripts": {
"prestart": "node buildScripts/startMessage.js",
"start": "npm-run-all --parallel security-check open:src",
"open:src": "node buildScripts/srcServer.js",
"security-check": "nsp check",
"localtunnel": "lt --port 3000",
@danivijay
danivijay / .editorconfig
Created December 12, 2017 13:59
.editorconfig by Dani Vijay
#editorconfig.org
root=true
[*]
indent_style = space
indent_size = 2
end_of_line = If
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@danivijay
danivijay / srcServer.js
Last active December 12, 2017 16:11
file to place within buildScripts/
var express = require('express');
var path = require('path');
var open = require('open');
var port = 3000; //choose different, if this port not available
var app = express();
app.get('/',function(req, res) {
res.sendFile(path.join(__dirname, '../src/index.html'));
});
@danivijay
danivijay / webpack.config.dev.js
Created December 13, 2017 15:33
Webpack 3.6 config for dev
import webpack from 'webpack';
import path from 'path';
export default {
devtool: 'inline-source-map',
entry: [
path.resolve(__dirname, 'src/index')
],
target: 'web',
output: {
import express from 'express';
import path from 'path';
import open from 'open';
const port = 3000; //choose different, if this port not available
const app = express();
app.get('/',function(req, res) {
res.sendFile(path.join(__dirname, '../src/index.html'));
});
@danivijay
danivijay / startMessage.js
Created December 16, 2017 12:42
updated version
import chalk from 'chalk';
console.log(chalk.green('Starting app in dev mode...'));
@danivijay
danivijay / Errors when cloning Wittr or starting Server.md
Last active March 6, 2018 12:19
Errors when cloning Wittr or starting Server

Errors when cloning Wittr or starting Server

Error - Facing-warnings or errors after running server(npm run serve)

Possible Solutions

  • Forgot the npm install command.
  • Clone again.
  • Change the current working directory to wittr.
  • Correct: npm run serve Incorrect: npm run server.
  • Delete the current folder and try installing from scratch.