Skip to content

Instantly share code, notes, and snippets.


Lek Huda mkhuda

Block or report user

Report or block mkhuda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mkhuda / github-store.js
Created Jul 31, 2018 — forked from alexvcasillas/github-store.js
Async Fetching with MobX Actions
View github-store.js
import fetch from 'node-fetch';
import { observable, action, runInAction } from 'mobx';
export default class GithubStore {
@observable searchName;
@observable user;
@observable repos;
@observable fetchingData;
constructor() {
mkhuda / vimrc.plugins
Created Jul 12, 2018 — forked from micahriggan/vimrc.plugins
Vim with javascript plugins and general developing plugins
View vimrc.plugins
" General Developer Plugins
Plugin 'VundleVim/Vundle.vim'
" plugin manager
Plugin 'Valloric/YouCompleteMe'
" autocomplete 5/5
Plugin 'scrooloose/nerdtree'
mkhuda /
Last active May 20, 2018 — forked from cecilemuller/
Let's Encrypt for Ruby on Rails with Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

For Ruby on Rails with Nginx (Puma or Phusion Passenger)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up

mkhuda /
Last active May 16, 2018
Install Vim 8 with Python, Python 3, Ruby, Lua, Clipboard and Arabic support on Ubuntu 14.04/16.04
# remove all installed vim package
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
# install dependencies (for normal users)
sudo apt-get install gtk+-2.0 liblua5.1-dev luajit libluajit-5.1 python-dev python3-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
# install dependencies (for ruby-rbenv users)
sudo apt-get install gtk+-2.0 liblua5.1-dev luajit libluajit-5.1 python-dev python3-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
# Optional: so vim can be uninstalled again via `dpkg -r vim`
mkhuda / array_john_subci.rb
Last active Apr 3, 2018
Looping an array by indexing some element in array itself
View array_john_subci.rb
def self.readfile
### best case for indexing text file containing number followed by total number of paragraph
file ='').read
readresult = file.split("\n")
filelength = readresult.length
i = 0
x = 0
m = 0
reschild =
resparent =
mkhuda / array_john_subci.js
Created Mar 31, 2018
Looping array by indexing some number
View array_john_subci.js
var ar = ["5", "3", "jhj", "opp", "tyt", "hkl", "aji", "6", "3", "kak", "lop", "gyt", "uyt", "ert", "wqa", "2", "3", "hhh", "bbb", "2", "5", "jonru", "bando"];
var i = 0;
var x = 0;
var reschild = [];
var resparent = [];
var m = 0;
while (i < ar.length) {
count_row = parseInt(ar[i]);
length_text = parseInt(ar[i+1]);
if(count_row > 0){
mkhuda / array_hash_ruby_snippet.rb
Created Nov 11, 2017
Ruby Array and Hash snippets to remember
View array_hash_ruby_snippet.rb
# Array
## Manipulating element of string using squish (remove last whitespace) within array
Array.collect{|a| a.squish || a }
## Return an array values by key of hash
## Return an array keys from key of Hash
mkhuda / text_processing_helper.rb
Created Oct 18, 2017
Text processing helper on Rails, used to process "RAW" data of KBBI.
View text_processing_helper.rb
module TextProcessingHelper
['dr', 'dari'],
['dl', 'dalam'],
['dng', 'dengan'],
['dsb', 'dan sebagainya'],
['dp', 'dari pada'],
['dst', 'dan seterusnya'],
['krn', 'karna'],
mkhuda / app.rb
Created Oct 12, 2017
APP Class for Simple API using Ruby and Sinatra
View app.rb
require "sinatra"
require_relative "my_db"
class App < Sinatra::Base
get '/' do
return "Hello from Sinatra.rb"
get '/show_komedian' do
content_type :json
mkhuda / my_db.rb
Created Oct 12, 2017
MySQL Database Class for Ruby Using Mysql2
View my_db.rb
require "mysql2"
class MyDatabase
def initialize
@client =
:host => "localhost",
:username => "root",
:password => "yourpassword",
:database => "sinatra"
You can’t perform that action at this time.