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
| configuration config { | |
| Import-DSCResource -module "nx" | |
| Node localhost { | |
| nxFile content | |
| { | |
| DestinationPath = "/home/chedy/content.txt" | |
| Mode = "644" | |
| Type = "file" | |
| Contents = "KABLAM!" |
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
| public override bool Equals(object obj) | |
| { | |
| if (obj.GetType() == typeof(FingerPrint)) | |
| { | |
| FingerPrint other = obj as FingerPrint; | |
| return GetType() | |
| .GetProperties() | |
| .Aggregate(true, (acc, p) => | |
| { | |
| var val = p.GetValue(this); |
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
| defmodule Solution do | |
| def get_stream_of_duplicated_evens() do | |
| Stream.iterate(2, &(&1+2)) | |
| |> Stream.flat_map(&List.duplicate(&1, 4)) | |
| end | |
| def get_result_list(n) do | |
| Enum.take(get_stream_of_duplicated_evens, n) | |
| |> get_result_list([1]) | |
| end |
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
| //file: main.js | |
| import {Vegetable} from "./mylib" | |
| //alternatively | |
| import * as mylib from "./mylib" | |
| let vegi = new Vegetable(); | |
| ... |
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
| //file: mylib.js | |
| export class Vegetable { | |
| ... | |
| } | |
| export function increment(n) { | |
| ... | |
| } | |
| function format(n) { |
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 numbers = [1, 2, 3]; | |
| // a = 1, b = 2, c = 3 | |
| let [a, b, c] = numbers; | |
| let obj = {name: 'Michael', lastName: 'Kael'}; | |
| // n = 'Michael', ln = 'Kael' | |
| let {name: n, lastName: ln} = obj; |
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 numbers = [1, 2, 3, 4, 5, 6, 7, 8]; | |
| // returns [2, 3, 4, 5, 6, 7, 8, 9] | |
| let incremented = numbers.map((n) => (n + 1)); | |
| console.log(incremented); | |
| //returns [4, 5, 6, 7, 8] | |
| let filtered = numbers.filter((n) => (n > 3)); | |
| console.log(filtered); |
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 numbers = [1, 2, 3, 4, 5]; | |
| for (let n of numbers) { | |
| console.log(n); | |
| } |
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 Person { | |
| constructor(name) { | |
| this._name = name; | |
| } | |
| set name(newName) { this._name = newName; } | |
| get name() { return this._name; } | |
| say_hello() { | |
| console.log(`Hi my name is ${this._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
| (0..16) | |
| |> Enum.reduce({[1], 0}, fn counter, {[h | _] = result, incr} -> | |
| incr = if rem(counter, 4) == 0, do: incr + 2, else: incr | |
| {[h + incr | result], incr} | |
| end) | |
| |> elem(0) | |
| |> Enum.reverse |
NewerOlder