$ docker
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
| 'use strict'; | |
| const fs = require('fs'); | |
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf-8'); | |
| let inputString = ''; | |
| let currentLine = 0; |
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
| #include <cs50.h> | |
| #include <stdio.h> | |
| int get_positive_int(string prompt); | |
| int main(void) | |
| { | |
| int h = get_positive_int("Height: "); | |
| for (int i = 0; i < h; i++) { | |
| for ( int j = h - i; j > 1; j--) { | |
| printf(" "); |
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
| import 'dart:math'; | |
| void main() { | |
| List<String> myList = [ | |
| 'Angela', | |
| 'Tony', | |
| 'June', | |
| 'Tessie' | |
| ]; |
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
| // Inheritance of Actions | |
| void main() { | |
| // Car myNormalCar = Car(); | |
| // myNormalCar.drive(); | |
| // print(myNormalCar.numberOfSeats); | |
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
| // Class constructors | |
| void main() { | |
| Human june = Human(165, 120); | |
| print(june.height); | |
| print(june.weight); | |
| Human tony = Human(170, 140); | |
| print(tony.height); |
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
| // Hook | |
| export default function useLocalStorage(key, initialValue) { | |
| // State to store our value | |
| // Pass initial state function to useState so logic is only executed once | |
| const [storedValue, setStoredValue] = useState(() => { | |
| try { | |
| // Get from local storage by key | |
| const item = window.localStorage.getItem(key); | |
| // Parse stored json or if none return initialValue | |
| return item ? JSON.parse(item) : initialValue; |
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
| let arr1 = [13, -3, -25, 20, -3, -16, -23, 18, 20, -7, 12, -5, -22, 15, -4, 7]; | |
| function maxSubArray (nums) { | |
| let maxC = nums[0]; | |
| let maxG = nums[0]; | |
| for (let i = 1; i < nums.length; i++) { | |
| maxC = Math.max(nums[i], maxC + nums[i]); | |
| maxG = maxC > maxG ? maxC : maxG; | |
| } |
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
| /* | |
| Prompt: | |
| We have defined a basic dropdown via the Dropdown and DropdownItem components below, with example usage | |
| in the ExampleNav component. The Dropdown and DropdownItem components have some problems, and also | |
| have room for improvements (doesn't everything?) A couple items TODO here (make sure to explain with comments!) | |
| 0. How are you today? 😊 | |
| I am great. This is an interesting exercise | |
| 1. Please fix any obvious issues and make you see with the dropdown. |
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 countBits = n => n.toString(2).split('0').join('').length | |
| countBits(1234); |