Skip to content

Instantly share code, notes, and snippets.

View antsmartian's full-sized avatar
💭
Hacking...

antsmartian antsmartian

💭
Hacking...
  • India
View GitHub Profile
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
networks:
- elastic-jaeger
ports:
- "127.0.0.1:9200:9200"
- "127.0.0.1:9300:9300"
/*
1. In JavaScript, define a function `makeCounter` which takes one optional argument defining the intial value, `start`, with a default value of 0. The function should return an object containing keys that define 3 methods: - `value` returns the current value of the counter - `increment` increments the value of the counter by 1 and returns the new value - `decrement` decrements the value of the counter by 1 and returns the new value The returned object should not allow direct modification or retrieval of the value.
Example usage:
var counter = makeCounter();
console.log(counter.value()); // 0
var counter2 = makeCounter(4);
console.log(counter2.value()); // 4
console.log(counter2.increment()); // 5
console.log(counter2.value()); // 5
counter2.decrement();
// import {plainToClass} from "class-transformer";
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-proposal-decorators"]
});
/*
{
"id": 1,
"firstName": "Johny",
"lastName": "Cage",
package main
import (
"net"
"os"
"strings"
"fmt"
"syscall"
"time"
"strconv"
package main
import (
"fmt"
"net/http"
"io/ioutil"
"golang.org/x/net/html"
"bytes"
"github.com/PuerkitoBio/goquery"
"net/url"
https://dave.cheney.net/
import React, { Component, createContext } from 'react'
function initStore(store) {
const Context = createContext();
class Provider extends React.Component {
constructor() {
super();
this.state = store.initialState;
}
package main
import (
"time"
"net"
"os"
"strings"
"fmt"
"syscall"
)
package main
import (
"sync"
)
type DB struct {
mu sync.RWMutex
data map[string]string
}