Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Reza Indra rezaindrag

🎯
Focusing
View GitHub Profile
View gist:d854284c00b61cd2faa4dc1e380f1003
//Regular Expressions List
//Short Tutorial
\ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. // match any character except newline
x // match any instance of x
[^x] // match any character except x
[x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| // an OR operator - [x|y] will match an instance of x or y
View recipe.proto
syntax = "proto3";
package grpc;
option go_package = "./grpc";
service RecipeService {
rpc FetchRecipe(RecipeFilter) returns (RecipeResult) {}
}
service RecipeCategoryService {
View learn-k8s.md

Terms in Kubernetes

Komponen & Arsitektur Kubernetes

K82 Component

Kubernetes Cluster

  • Ketika kita me-running sebuah Kubernetes, artinya kita me-running sebuah Cluster (Kubernetes Cluster).
  • Cluster terdiri dari dua bagian besar, yakni Kubernetes Master dan Kubernetes Worker/Node
View home-feed.json
[
{
"id": "c-17",
"title": "Campaign and Activity",
"items": [
{
"id": "47",
"type": "link",
"saved": false,
"text": "Chef Siscaa",
View company.handler.test.js
const expect = require("chai").expect;
const { spy, stub } = require("sinon");
const companyService = require("../src/services/company.service");
const companyHandler = require("../src/handlers/company.handler");
const companyProfileMock = {
companyName: 'Facebook Inc',
companyUsers: [
{ id: 1, name: 'mojombo' },
View company.service.test.js
const expect = require("chai").expect;
const { stub } = require("sinon");
const companyRepository = require("../src/repositories/company.repository");
const companyService = require("../src/services/company.service");
const usersMock = require("./mocks/users");
const employeesMock = require("./mocks/employees");
describe("test company service", function () {
afterEach(() => {
View company.repository.test.js
const expect = require("chai").expect;
const nock = require("nock");
const companyRepository = require("../src/repositories/company.repository");
const usersMock = require("./mocks/users");
describe("test company repository", function () {
after(function() {
nock.restore();
});
View company.handler.js
const companyService = require("../services/company.service");
async function fetchCompanyProfile(req, res) {
try {
const companyProfile = await companyService.fetchCompanyProfile();
res.json(companyProfile);
} catch (e) {
errorResponse(e, res);
}
View company.service.js
const companyRepository = require("../repositories/company.repository");
async function fetchCompanyProfile() {
const users = await companyRepository.fetchUsers();
const employees = await companyRepository.fetchEmployees();
const companyUsers = [];
for (let user of users) {
companyUsers.push({
id: user.id,
View company.repository.js
const axios = require("axios");
async function fetchUsers() {
const { data } = await axios.get("https://api.github.com/users");
return data;
}
async function fetchEmployees() {
const { data: { data } } =