Skip to content

Instantly share code, notes, and snippets.

View turastory's full-sized avatar
👋
Focusing

Yoon Ho Na turastory

👋
Focusing
View GitHub Profile
@turastory
turastory / validation.ts
Created July 14, 2022 09:22
regular expressions for common inputs (email, special characters)
const emailRegex =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
const specialCharacterRegex = /[~`!@#$%\^&*\(\)_+\-=\[\]{};':"\\|,.<>\/?]/;
function isEmail(value: string) {
return emailRegex.test(value);
}
function isSpecialCharacter(value: string) {
@turastory
turastory / JamquerySpec.md
Last active February 9, 2021 14:27
Jamquery specification

Spec

Jamquery is a simple application for purpose of learning new languages.

  1. jam - User can type any keyword, along with the message to store the message with the keyword as a key.
    $ jam GitHub "The largest hub for storing Git repositories"
    A new jam 'GitHub' successfully added.
  2. query - User can search existing jams and find that matches the keywords.
@turastory
turastory / how-to-resize-image.sh
Last active August 12, 2020 06:51
A set of scripts for importing icons which are in svg format & resizing rasterized images, into my project.
# Head over to where the resources files are located
cd ~/Downloads
# Run image resizer
aaresize --density=xxxhdpi --xxxhdpi --out=. images/*
# Check out the files
ls -R res
@turastory
turastory / AndroidManifest.xml
Created April 9, 2019 01:30
Android deep link
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="test.com"
android:scheme="https" />
@turastory
turastory / .vimrc
Created December 27, 2018 07:56
.vimrc (in progress)
syntax on " Enable syntax highlighting
filetype plugin indent on " Enable file type based indentation.
set nu
set autoindent " Respect indentation when starting a new line.
set expandtab " Expand tabs to spaces.
set tabstop=4 " Number of spaces tab is counted for.
set shiftwidth=4 " Number of spaces to use for autoindent
set backspace=2 " Fix backspace behavior on most terminals.
@turastory
turastory / layout_with_fab.xml
Last active October 1, 2018 11:47 — forked from simonesestito/layout_with_fab.xml
Android - Extended FAB using Material Button
<android.support.design.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="16dp"
android:elevation="12dp"
android:paddingStart="12dp"
android:paddingEnd="20dp"
android:text="Text Here"
@turastory
turastory / flexible.xml
Created March 30, 2018 14:16
Flexible Layout with ConstraintLayout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="@+id/image_container"
@turastory
turastory / Runner.java
Created March 26, 2018 10:42
Runner, for Runnable chain
public interface Runner {
void run();
default Runner andThen(Runner after) {
return () -> { run(); after.run(); };
}
default Runnable convert() {
return this::run;
}
}
@turastory
turastory / ConstantEditText.java
Created February 22, 2018 03:47
Use of onKeyPreIme
/**
* Does not hide the keyboard when back key pressed
* and perform specified action that provided by Listener.
*/
public class ConstantEditText extends AppCompatEditText {
public interface OnBackKeyListener {
void onBackKeyPressed();
}
@turastory
turastory / PreventHideKeyboard.java
Created February 22, 2018 02:50
Android - Prevent Keyboard Hide when action performed
editText.setOnEditorActionListener((v, actionId, event) -> {
// Specify the action what you want
if (actionId == EditorInfo.IME_ACTION_DONE) {
// System does not going to handle this action.
return true;
}
return false;
});