This file contains hidden or 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
// I liked reduce. It's weird, but it's quirky, but I don't find it easy to understand at quick glance for all devs | |
const minSum_short = (num, k) => { | |
return new Array(k) | |
.fill(undefined) // not crazy about this aspect | |
.reduce( | |
(prev) => { | |
// Sort the array high to low | |
const current = prev.sort((a, b) => b - a) | |
// Swap the maximum value with the updated one | |
current[0] = Math.ceil(current[0] / 2) |
This file contains hidden or 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
package interviewProject; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
public class InterviewMain { | |
public static void main(String[] args) { | |
// Prime Number detector |
This file contains hidden or 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
package InterviewProject; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
public class InterviewMain { | |
public static void main(String[] args) { | |
// Prime Number detector |
This file contains hidden or 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 bodyParser = require("body-parser") | |
var mongoose = require("mongoose") | |
var userSchema = mongoose.Schema({ | |
name: String, | |
email: String, | |
password: String, | |
token: String, // this is for the example code, JWT would be used in a real life scenario |
This file contains hidden or 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 constructPropertyFromArgs = function (fn, args) { | |
return [].concat(fn.name, args).join('|'); | |
} | |
const memoize = function (fn) { | |
const cache = {} | |
return function(...args) { | |
const propCheck = constructPropertyFromArgs(fn, args); | |
if (!cache[propCheck]) { |
This file contains hidden or 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
{ | |
"session":{ | |
"new": true, | |
"sessionId":"SessionId.[unique-value-here]", | |
"application":{ | |
"applicationId":"amzn1.ask.skill.[YOUR_SKILL_ID_HERE]" | |
}, | |
"attributes":{ | |
"key": "string value" | |
}, |
This file contains hidden or 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
// super simple express server | |
'use strict' | |
const http = require(`http`); | |
const port = 8080; | |
const server = http.createServer((req, res) => { | |
res.end(`Hello, World!`); | |
}); | |
server.listen(port, (err) => { |
This file contains hidden or 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 sayHello = () => { | |
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { | |
var args = ['\n %c Made with ♥ by <name> %c %c %c http://www.dogstudio.co/ %c %c \n', 'color: #fff; background: #e43333; padding:5px 0;', 'background: #131419; padding:5px 0;', 'background: #131419; padding:5px 0;', 'color: #fff; background: #1c1c1c; padding:5px 0;', 'background: #fff; padding:5px 0;', 'color: #e43333; background: #fff; padding:5px 0;'] | |
window.console.log.apply(console, args) | |
} else if (window.console) { | |
window.console.log('Made with love ♥ <name> - http://www.dogstudio.co/') | |
} | |
} | |
export default sayHello |
This file contains hidden or 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
#!/bin/bash | |
# Include any branches for which you wish to disable this script | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master main develop test) | |
fi | |
# Get the current branch name and check if it is excluded | |
BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
BRANCH_NAME="${BRANCH_NAME##*/}" |
This file contains hidden or 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
[alias] | |
# log outputs | |
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --date=short | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat | |
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate | |
# fancy log output | |
log-fancy = log --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative | |
log-me = !UN=$(git config user.name)&& git log --author="\"$UN\"" --pretty=format:'%h %cd %s' --date=short | |
log-nice = log --graph --decorate --pretty=oneline --abbrev-commit | |
# standup = log --since '1 day ago' --oneline --author <YOUREMAIL> # hack it with your email and uncomment |