- Syntax
- for-of-Loop
- const vs let
- Spread-Syntax (
...) - Optional Chaining (
?.) - Nullish Coalescing Operator (
??) - Arrow-Functions
- Destructuring Assignment
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 arr = [1,1,0,0,1,1,1,0,1]; | |
| function sumConsecutiveOnes(arr) { | |
| return [...arr, 0].reduce((acc, value) => { | |
| if(value === 1) { | |
| acc.counter += 1; | |
| } else if(acc.counter > 0) { | |
| acc.output.push(acc.counter); | |
| acc.counter = 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
| from ortools.sat.python import cp_model | |
| COUNTS = 10 | |
| MIN_VAL = 2 | |
| MAX_VAL = 4 | |
| class Slot: | |
| def __init__(self,model): | |
| self.model = model | |
| self.start = model.NewIntVar(-1,COUNTS-1,name="")#inclusive |
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
| from docplex.mp.model import Model | |
| m = Model("test") | |
| a = m.binary_var(name="a") | |
| b = m.binary_var(name="b") | |
| c = m.binary_var(name="c") | |
| m.add_constraint(m.logical_and(a, b) == c) | |
| m.add_constraint(a == 1) |
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
| Option Explicit | |
| Sub IntersectionMacro() | |
| Dim set1 As New Scripting.Dictionary | |
| Dim set2 As New Scripting.Dictionary | |
| Dim result As New Scripting.Dictionary | |
| set1.Add "M AB 123", "" | |
| set1.Add "M CD 456", "" |
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
| type Employee = { | |
| canWalkVeryFast: boolean; | |
| numberOfKeystrokes: number; | |
| isNiceToTheBoss: "yes" | "no" | "sometimes"; | |
| }; | |
| function foobar<T extends keyof Employee>(key: T, value: Employee[T]) { | |
| console.log(key, 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
| class MapOfComplexData< | |
| Key, | |
| Value, | |
| HashFn extends (key: Key) => number = (key: Key) => number, | |
| EqualsFn extends (objA: Key, objB: Key) => boolean = (objA: Key, objB: Key) => boolean | |
| > { | |
| private _data = new Map<number, {key: Key; value: Value}[]>(); | |
| private _size: number = 0; | |
| private hashCode: HashFn; | |
| private equals: EqualsFn; |
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
| FROM php:7.3.0-apache | |
| COPY . /var/www/html/ | |
| WORKDIR /var/www/html |
OlderNewer