Skip to content

Instantly share code, notes, and snippets.


Mirzalazuardi Hermawan mirzalazuardi

View GitHub Profile
View gist:a52c2bd3093451bb2dc545a04740e2b6
# Dockerfile
FROM ruby:2.6.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client-11 graphviz &&\
curl -sL | bash - && \
curl -sS | apt-key add - && \
echo "deb stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn
RUN mkdir /app
ADD Gemfile /app/Gemfile
mirzalazuardi / scrap.rb
Last active May 19, 2020
scrapping with watir and nokogiri (dynamic js)
View scrap.rb
browser =, headless: true)
doc = browser.element(css: 'html').wait_until(&:present?)
mirzalazuardi / .pryrc
Created Oct 4, 2019
pry configuration
View .pryrc
require 'rubygems'
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.config.editor = "nvim"
def pbcopy(input)
str = input.to_s
IO.popen('pbcopy', 'w') { |f| f << str }
View pipeline.php
/**As part of a data processing pipeline, complete the implementation of the make_pipeline method:
- The method should accept a variable number of functions, and it should return a new function that accepts one parameter $arg.
- The returned function should call the first function in the make_pipeline with the parameter $arg, and call the second function with the result of the first function.
- The returned function should continue calling each function in the make_pipeline in order, following the same pattern, and return the value from the last function.
For example, Pipeline::make_pipeline(function($x) { return $x * 3; }, function($x) { return $x + 1; }, function($x) { return $x / 2; }) then calling the returned function with 3 should return 5.
class Pipeline
public static function make_pipeline()
View palindrome.php
/**A palindrome is a word that reads the same backward or forward. Write a function that checks if a given word is a palindrome.
* Character case should be ignored. For example, isPalindrome("Deleveled") should return true as character case should be ignored, resulting in "deleveled", which is a palindrome since it reads the same backward and forward.
class Palindrome
public static function isPalindrome($word)
$word = trim($word);
$word = strtolower($word);
View num_of_student.sql
-- Students
-- Given the following data definition, write a query that returns the number of students whose first name is John.
-- TABLE students
-- firstName VARCHAR(30) NOT NULL,
-- lastName VARCHAR(30) NOT NULL
SELECT COUNT(*) AS numOfStudent
FROM students
WHERE firstName = 'John'
View not_manager_employees.sql
-- Workers
-- The following data definition defines an organization's employee hierarchy. An employee is a manager if any other employee has their managerId set to the first employees id. An employee who is a manager may or may not also have a manager.
-- TABLE employees
-- managerId INTEGER REFERENCES employees(id)
-- name VARCHAR(30) NOT NULL
-- Write a query that selects the names of employees who are not managers.
FROM employees
WHERE id IN (SELECT id FROM employees WHERE managerId IS NULL)
View gist:38473661fd046d5720481d1b39d51e0d
### Keybase proof
I hereby claim:
* I am mirzalazuardi on github.
* I am mirzalazuardi ( on keybase.
* I have a public key ASCzDoTqBV31bYSm2slkGSLd6XZFA5irVOtCS4xaihKFngo
To claim this, I am signing this object:
mirzalazuardi / nginx.conf
Created Dec 30, 2017 — forked from terrywang/nginx.conf
nginx config file template for Debian and Ubuntu
View nginx.conf
# User and group used by worker processes
user www-data;
# Ideally # of worker processes = # of CPUs or cores
# Set to auto to autodetect
# max_clients = worker_processes * worker_connections
worker_processes auto;
pid /run/;