Skip to content

Instantly share code, notes, and snippets.

View kenanhancer's full-sized avatar
🎯
Focusing

kenan hancer kenanhancer

🎯
Focusing
View GitHub Profile
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ProgressBar5
{
public class Program
@kenanhancer
kenanhancer / Main.java
Created March 29, 2018 15:56
SingletonPatternExample1 created by kenanhancer - https://repl.it/@kenanhancer/SingletonPatternExample1
rclass Main {
public static void main(String[] args) {
SingletonV1 singletonv1 = SingletonV1.getInstance();
singletonv1.doSomething();
SingletonV2 singletonV2 = SingletonV2.getInstance();
const http = require('http');
class PipelineBuilder {
static build(functions, index = 0) {
if (functions.length == index) return sett => {};
let aggregateFunc = settings =>
functions[index](settings, PipelineBuilder.build(functions, index + 1));
return aggregateFunc;
let Person = function(personId, firstName, lastName, age, gender) {
this.personId = personId;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
};
Person.prototype.getFullName = function() {
return `${this.firstName} ${this.lastName}`;
const delay = duration => new Promise(resolve => setTimeout(resolve, duration));
const job1 = async () => {
for (let i = 0; i < 10; i++) {
console.log('*');
await delay(100);
}
};
const job2 = async () => {
const delay = duration => new Promise(resolve => setTimeout(resolve, duration));
const uniqueId = () =>
Math.random().toString(36).substring(2) + new Date().getTime().toString(36);
class Person {
constructor(firstName, lastName) {
this.PersonId = uniqueId();
this.firstName = firstName;
this.lastName = lastName;
let pipelineBuilder = (functions, index = 0) => {
if (functions.length == index) return env => {}; //Default handler
let pipelineFunc = environment =>
functions[index](environment, pipelineBuilder(functions, index + 1));
return pipelineFunc;
};
const middleware1 = (environment, next) => {
Function.prototype.inherits = function(parentClassOrObject) {
let child = this;
function temp() {
this.constructor = child;
}
temp.prototype = parentClassOrObject.prototype;
this.prototype = new temp();
return this;
};
class Person {
constructor(personId, firstName, lastName, age, gender) {
this.personId = personId;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
}
getFullName() {
System.out.println("Hello world!");
System.out.println("Hello world!")
System.out.println "Hello world!"
println("Hello world!");
println("Hello world!")
println "Hello world!"
def name = "John"