Skip to content

Instantly share code, notes, and snippets.

View myeonwoo's full-sized avatar

Myeonwoo Lim myeonwoo

View GitHub Profile
@myeonwoo
myeonwoo / regex_samples.js
Last active September 18, 2023 00:38
Javascript: Regex - examples
/**
* Javascript: Regex - examples
* regex.test(input);
*/
// email
var regex_email = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var regex_email_simple = /\S+@\S+\.\S+/;
var regex_email_complex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@myeonwoo
myeonwoo / JsGuideBegginer.md
Last active January 15, 2019 10:03
JavaScript: Guide - Begginer
@myeonwoo
myeonwoo / MarkdownCheatSheet.md
Last active August 7, 2018 06:36
Markdown Cheat Sheet
@myeonwoo
myeonwoo / GitCheatSheet.md
Last active December 13, 2018 01:18
Git Cheat Sheet
@myeonwoo
myeonwoo / VimCheatSheet.md
Last active August 6, 2019 04:41
Vim Cheat Sheet

vi command ref: https://vim.rtorr.com

Cursor Movement

cmd desc
0 move to beginning of the current line
$ move to end of line
H move to the top of the current window (high)
M move to the middle of the current window (middle)
@myeonwoo
myeonwoo / styles.html
Last active March 22, 2024 08:33
HTML: CSS Style - collection
<!-- 모달 -->
<div id="id-mymodal1" class="mymodal">
<!-- Modal content -->
<div class="mymodal-content">
<span class="myclose">&times;</span>
<p>Some text in the Modal..</p>
<p>Some text in the Modal..</p>
</div>
</div>
<script>
@myeonwoo
myeonwoo / div-on.js
Last active October 18, 2023 05:44
JavaScript: dev-on
/* call api */
async function callRestapi(url, formData, callback){
let response = await fetch(url, {
method: 'POST',
body: formData
});
let result = await response.json();
callback(result);
}
@myeonwoo
myeonwoo / usefulquery.sql
Last active August 11, 2021 05:33
MYSQL: useful query
-- explain
explain [sql]
-- update multiple rows using limit in MySQL you can use this construct
UPDATE table_name SET name='test'
WHERE id IN (
SELECT id FROM (
SELECT id FROM table_name
ORDER BY id ASC
LIMIT 0, 10
@myeonwoo
myeonwoo / base64.js
Created November 28, 2017 09:52
JavaScript: Encryption - Base64
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
@myeonwoo
myeonwoo / detectDevice.js
Created November 20, 2017 08:06
JavaScript: Validation - Detect Device
(function(a) {
window.client_browser = {};
client_browser.isMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|j