Simulating a with statement to demonstrate the dangers.
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
using Sandbox.Game.EntityComponents; | |
using Sandbox.ModAPI.Ingame; | |
using Sandbox.ModAPI.Interfaces; | |
using SpaceEngineers.Game.ModAPI.Ingame; | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.Immutable; | |
using System.Linq; | |
using System.Text; |
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
// (Impure) Functional javascript kata inspired by | |
// Puzzle 2: The Best Time to Party | |
// MIT 6.S095 Programming for the Puzzled, IAP 2018 | |
// https://youtu.be/a1RaIqkdG0c | |
// Assuming that the list of celebrities can be very large | |
// and the number of hours are limited (small) | |
// This solution only traverses the list once | |
// Celebrities arrival and departure times |
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
'use strict'; | |
/* eslint-env browser */ | |
/** | |
* Module dependencies. | |
*/ | |
var Base = require('./base'); | |
var utils = require('./utils'); |
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
// Node program to print all available info from the 'os' module using functional style. | |
const os = require('os'); | |
const allInfo = Object.keys(os); | |
const isOsFunction = (item) => typeof os[item] === "function"; | |
const isNotOsFunction = (item) => typeof os[item] !== "function"; | |
const callFunction = (info) => ({[info+'()']: os[info]()}); |