Skip to content

Instantly share code, notes, and snippets.

View pllearns's full-sized avatar

Phillip Lorenzo pllearns

  • FYC Labs
  • Portland, OR
View GitHub Profile
function logNumbers(start, end) {
for (var 1 = start; i <= end; i++) {
console.log(i)
}
}
function logRecursively(start, end) {
function recurse(i) {
console.log(i)
@pllearns
pllearns / shortestPathWithEdge.js
Created May 18, 2017 22:49
Google Interview Question -- initial implementation of shortestPathWithEdge
function shortestPathWithEdge(start, finish, weight, graph) {
const results = {}
const possible = Infinity
let edges = getEdges(finish)
while (edges.length > 0) {
edge = edges.shift()
if(results[edge.v].cost === Infinity) {
results[edge.v] = {cost: edge.c, stack:[edge.v]}
@pllearns
pllearns / routes.js
Created May 11, 2017 01:55
Difficulty with Express Routes
// This was the solution that I found on Stack Overflow after google searching express routes with api
var express = require('express')
var router = express.Router(); // Create our Router Middleware
// GET / route
router.get('/', function(req, res) {
return res.status(200).send('GET /api received!');
});
@pllearns
pllearns / adjacentElementsProduct.js
Last active December 10, 2020 06:31
CodeFights Solutions
function adjacentElementsProduct(inputArray) {
var numbers = -100
for (var i = 0; i < inputArray.length; i++) {
if (inputArray[i] * inputArray[i + 1] >= numbers) {
numbers = inputArray[i] * inputArray[i + 1]
}
}
return numbers
}
@pllearns
pllearns / PersonalWebsiteGoal.md
Last active May 12, 2017 21:49
Cycle 42 - Specs

Repo for Personal Website

NOTE: I will be publishing the personal site this weekend through a domain name and through the now domain platform.
@pllearns
pllearns / program.js
Created May 1, 2017 17:51
Solution to http.collect ----> learnyounode http.collect
'use strict'
var http = require('http')
var bl = require('bl')
http.get(process.argv[2], function(response) {
response.pipe(bl(function(err, data) {
if (err) {
console.error(err)
}
@pllearns
pllearns / program.js
Created May 1, 2017 17:25
Solution to http.client in learnyounode --> http.client
'use strict'
var http = require('http')
http.get(process.argv[2], function(response) {
response.setEncoding('utf-8')
response.on('data', console.log)
response.on('error', console.log)
})
@pllearns
pllearns / program.js
Created May 1, 2017 17:13
Solutions to Learnyounode ---> Make it Modular
'use strict'
var readFile = require('./readFile.js')
var file = process.argv[2]
var filtered = process.argv[3]
readFile(file, filtered, function(err, list) {
if (err) {
return console.log(err)
}
@pllearns
pllearns / Story 1078
Created March 27, 2017 21:09
floppy-alpaca-slack-transfer
One part of the LG transfer to slack
Related: https://app.clubhouse.io/learnersguild/story/1075
### Specs - addresses story 1078
- [ ] Identify and replace current echo/RC API extensions and replace with SLACK HTTP API.
- [ ] Point the chat client code in `game` to invoke existing methods in Slack HTTP API.
#### Original Story Source