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
class Bar { | |
constructor() { | |
this.foo = "foo from Bar"; | |
} | |
fooFunc() { | |
return this.foo; | |
} | |
} | |
class Foo { |
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'; | |
/* | |
* Usage: | |
* | |
* const gracefulShutdown = require('./app/utils/gracefulShutdown'); | |
* | |
* const server = app.listen(port, callback) | |
* | |
* gracefulShutdown.init(server, logger); |
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 getNickname(fullname) { | |
return fullname | |
.split(/\s+/) | |
.map(n => n.substring(0,3)) | |
.join(''); | |
} | |
const result = getNickname('Daniel Gerlach'); | |
console.log(result); // => DanGer |
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
"""Simple clock implementation which supports basic functions like | |
addition and subtracting minutes. Time overflows are supported. | |
""" | |
# number of minutes of a day | |
day_minutes = 24 * 60 | |
class Clock(): | |
def __init__(self, hours, minutes): |
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 Clean Code chapter 10 | |
// listing 10-8 | |
package literatePrimes; | |
import java.util.ArrayList; | |
public class PrimeGenerator { | |
private static int[] primes; | |
private static ArrayList<Integer> multiplesOfPrimeFactors; |
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
""""Given a fixed length array arr of integers, duplicate each occurrence | |
of zero, shifting the remaining elements to the right. | |
Note that elements beyond the length of the original array are not | |
written. | |
Do the above modifications to the input array in place, do not return | |
anything from your function. | |
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
# Program collects all primes less than or equal n. | |
# It uses the Sieve of Eratosthenes algorithm, see | |
# https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes | |
def primes(n): | |
# Initializes start array with n-entries, all numbers are primes initially | |
prime = [True for i in range(n + 1)] | |
# 0 and 1 are no primes |