View interviewing.js
This file contains 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
// 1. What is the difference between an array and a set? | |
// --- | |
const values = []; | |
const _values = new Set(); | |
// 2. What is the difference between an object and a map? | |
// --- | |
const dict = {}; |
View checkDuplicates.js
This file contains 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 data = ["a", "b", "c", "d", "e", "e", "c"]; | |
function checkDuplicates(data) { | |
const n = new Map(); | |
for (let i = 0; i < data.length; i++) { | |
const element = data[i]; | |
if (n.has(element)) { | |
return i; | |
} |
View DarkMode.swift
This file contains 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
import Cocoa | |
import SwiftUI | |
import ServiceManagement | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
var statusBarItem: NSStatusItem! | |
View localstorage-mock.ts
This file contains 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
interface StringTMap<T> { | |
[key: string]: T; | |
} | |
export function storageMock() { | |
let storage: StringTMap<string> = {}; | |
return { | |
setItem(key: string, value: any) { | |
storage[key] = value || ""; |
View apollo-next.tsx
This file contains 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
import * as React from "react"; | |
import Head from "next/head"; | |
import { ApolloProvider } from "@apollo/react-hooks"; | |
import { ApolloClient } from "apollo-client"; | |
import { InMemoryCache, NormalizedCacheObject } from "apollo-cache-inmemory"; | |
import { HttpLink } from "apollo-link-http"; | |
import fetch from "isomorphic-unfetch"; | |
import { NextPage } from "next"; | |
let apolloClient = null; |
View hacker rank problems.ts
This file contains 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
function countingValleys(n, s) { | |
let seaLevel = 0; | |
let currLevel = 0; | |
let valleys = 0; | |
s = s.split(''); | |
for (let i = 0; i < s.length; i++) { | |
//update the current level | |
if (s[i] === 'U') { | |
currLevel += 1; |
View duotone.ganymede.css
This file contains 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
/* | |
Name: Duotone Ganymede | |
*/ | |
:root { | |
--keyword: #3274a9; | |
--tag: #e2a500; | |
--prev-normal: #4a5f78; | |
--normal: #143550; | |
--script: #e56353; |
View night-mode.js
This file contains 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
import React from "react"; | |
const Night = React.createContext({}); | |
export class NightModeProvider extends React.Component { | |
static defaultProps = { | |
className: "NightMode" | |
}; | |
state = { |
View Dockerfile
This file contains 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
FROM mhart/alpine-node:10 | |
WORKDIR /usr/src/app | |
COPY package.json ./ | |
# # add files to container | |
# ADD . /app | |
# # specify the working directory |
NewerOlder