Skip to content

Instantly share code, notes, and snippets.

View mkhuda's full-sized avatar
🎯
Focusing

Lek Huda mkhuda

🎯
Focusing
View GitHub Profile
@mkhuda
mkhuda / GameItem.tsx
Created June 5, 2024 08:43
with onLayout
import React, { useState } from 'react';
import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native';
const GameItem = () => {
const [bottomContainerHeight, setBottomContainerHeight] = useState(0);
return (
<View style={styles.container}>
<Text style={styles.headerText}>Game section bang</Text>
<Image
@mkhuda
mkhuda / GameItem.tsx
Created June 5, 2024 08:38
GameItem.tsx
import React from 'react';
import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native';
const GameItem = () => {
return (
<View style={styles.container}>
<Text style={styles.headerText}>Game section bang</Text>
<Image
style={styles.image}
source={{ uri: 'https://reactnative.dev/img/tiny_logo.png' }}
@mkhuda
mkhuda / reasonreact.re
Last active August 31, 2021 07:29
React.useRef to handle ReactDOMRe.domRef
React.useRef to handle ReactDOMRe.domRef
Here are a few solutions:
```ocaml
let inputRef = React.createRef();
<input ref={ReactDOMRe.Ref.domRef(inputRef)} type="text" />
```
If React.createRef is not available in your current version, simply use:
```ocaml
let inputRef = React.useRef(Js.Nullable.null);
@mkhuda
mkhuda / npm-git-package
Created August 14, 2021 05:50
NPM package from Github
"library-name": "git://github.com/username/repo-name.git#branch/child-branch",
@mkhuda
mkhuda / github-store.js
Created July 31, 2018 16:42 — forked from alexvcasillas/github-store.js
Async Fetching with MobX Actions
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
mkhuda / vimrc.plugins
Created July 12, 2018 18:42 — forked from micahriggan/vimrc.plugins
Vim with javascript plugins and general developing plugins
" General Developer Plugins
Plugin 'VundleVim/Vundle.vim'
" plugin manager
Plugin 'Valloric/YouCompleteMe'
" autocomplete 5/5
Plugin 'scrooloose/nerdtree'
@mkhuda
mkhuda / letsencrypt_2017.md
Last active May 20, 2018 22:08 — forked from cecilemuller/letsencrypt_2020.md
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 mydomain.com.

@mkhuda
mkhuda / install-vim.sh
Last active April 8, 2021 01:36
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
mkhuda / array_john_subci.rb
Last active April 3, 2018 14:13
Looping an array by indexing some element in array itself
def self.readfile
### best case for indexing text file containing number followed by total number of paragraph
file = File.open('test.in').read
readresult = file.split("\n")
filelength = readresult.length
i = 0
x = 0
m = 0
reschild = Array.new
resparent = Array.new
@mkhuda
mkhuda / array_john_subci.js
Created March 31, 2018 16:04
Looping array by indexing some number
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){