Skip to content

Instantly share code, notes, and snippets.

View mul14's full-sized avatar
:octocat:
Preparing for big things...

Mulia Nasution mul14

:octocat:
Preparing for big things...
View GitHub Profile
@mul14
mul14 / demo.sh
Last active June 4, 2022 18:55
I very often create new folder to demonstrate or experiment. Run mkdir, cd, git init, etc; each time when I need is painful. So, I create this simple bash script.
#!/bin/bash
demo () {
project_name=""
if [ $# -eq 0 ]; then
project_name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
else
if [[ ( $1 == "--help") || $1 == "-h" ]]; then
cat << EOF
@mul14
mul14 / DefaultKeyBinding.dict
Created August 4, 2019 00:31 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@mul14
mul14 / CPP_test.md
Last active July 9, 2019 11:44
Programming Test

Buatlah objek Person yang memiliki nama, tanggal lahir, jenis kelamin, tingkat kekuatan. Objek tersebut juga dapat berjalan, berlari, dan melompat.

Buatlah objek SuperHero yang mewarisi semua yang dimiliki Person dan memiliki nama julukan super hero. SuperHero dapat melakukan hal-hal yang tidak bisa Person lakukan, seperti terbang, tembus pandang, dan tingkat kekuatan lebih tinggi daripada Person.

Semua property dan kemampuan yang ada di Person tetap dapat dipanggil melalui SuperHero.

@mul14
mul14 / README.md
Last active January 4, 2024 12:34
Replace Laravel String and Array Helpers to Facade with regex
@mul14
mul14 / Form.js
Last active January 15, 2019 10:04
Vue.js Form class
class Form {
constructor (data) {
this._originalData = Object.assign({}, data)
for (let key in data) {
this[key] = data[key]
}
}
@mul14
mul14 / readme.md
Last active October 13, 2020 06:37
JavaScript Upload FormData
<form id="form">
  <input type="name" name="full_name" />
  <input type="file" name="image" />
  <button type="submit">Submit</button>    
</form>
// Fetch
@mul14
mul14 / profile.md
Created October 26, 2018 00:35 — forked from ezekg/profile.md
iTerm key bindings

Open the iTerm preferences ⌘+, and navigate to the Profiles tab (the Keys tab can be used, but adding keybinding to your profile allows you to save your profile and sync it to multiple computers) and keys sub-tab and enter the following:

Delete all characters left of the cursor

⌘+←Delete Send Hex Codes:

  • 0x18 0x7f – Less compatible, doesn't work in node and won't work in zsh by default, see below to fix zsh (bash/irb/pry should be fine), performs desired functionality when it does work.
  • 0x15 – More compatible, but typical functionality is to delete the entire line rather than just the characters to the left of the cursor.

Delete all characters right of the cursor

⌘+fn+←Delete or ⌘+Delete→ Send Hex Codes:

  • 0x0b
@mul14
mul14 / vue.config.js
Created October 23, 2018 14:25
Vue Configuration
const PurgecssPlugin = require('purgecss-webpack-plugin')
// const PurifycssPlugin = require('purifycss-webpack')
const glob = require('glob-all')
const path = require('path')
module.exports = {
lintOnSave: false,
configureWebpack: {
@mul14
mul14 / encrypto.js
Created October 15, 2018 17:05
Node.js v10 - crypto.createDecipheriv()
// This is example of using crypto.createCipheriv(), because
// crypto.createCipher() is deprecated since Node.js v10
const crypto = require('crypto')
const encrypto = {
encrypt(text, password) {
const key = password.repeat(32).substr(0, 32)
const iv = password.repeat(16).substr(0, 16)
@mul14
mul14 / index.js
Created July 25, 2018 14:29
JavaScript DocBlock Cheat Sheet
/**
* Description of this function.
*
* @param {string} name
* @param {Date} birthday
* @param {boolean=} isMarried Optional parameter.
* @param {string|null} [bloodType]
* @param {number=} [weight=0] Optional parameter with default value.
* @param {string[]} favoriteFoods Array of String.
*