Skip to content

Instantly share code, notes, and snippets.

View huynhducduy's full-sized avatar
😍
I'm in love with js <3

Huynh Duc Duy huynhducduy

😍
I'm in love with js <3
View GitHub Profile
/**
* jQuery afterTime() method is simply setTimeout() function that can be used to chain with jQuery selectors
* @param {ms} sec [the callback will excute after]
* @param {function} callback [the function to excute]
* @return {jQuery selectors}
*/
jQuery.fn.extend({
afterTime: function (sec, callback) {
that = $(this);
setTimeout(function () {
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\*\shell\runas]
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"Icon"="C:\\Windows\\System32\\imageres.dll,-78"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\*\shell\runas\command]
@ECHO OFF
TITLE Task Scheduling
:runSchedule
php artisan schedule:run
TIMEOUT /T 60 /NOBREAK > nul
goto runSchedule
@huynhducduy
huynhducduy / addition_classes_style.css
Created May 6, 2016 09:56
Ez way to handle style with these classes
/* Addition Style */
/*
none: 0px
sm: 5px
normal: 10px
lg: 22px
xl: 40px
*/
.padding-none {
padding: 0px !important;
<?php
function checkBOM($filePath) {
$isBOM = false;
if (is_file($filePath)) {
$str = file_get_contents($filePath);
$bom = pack("CCC", 0xef, 0xbb, 0xbf);
if (0 == strncmp($str, $bom, 3)) {
$isBOM = true;
$str = substr($str, 3);
file_put_contents($filePath, $str);
// Jquery exists function
/**
* jQuery exists() method can check if a selector matches or not
* @return {boolean}
*/
jQuery.fn.exists = function() {
return this.length;
}
@huynhducduy
huynhducduy / tmux-cheatsheet.markdown
Created October 18, 2016 10:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@huynhducduy
huynhducduy / template.ipynb
Created July 23, 2019 21:38
Jupyter Notebook Template
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@huynhducduy
huynhducduy / better_regex.py
Created November 21, 2019 04:14
REGEX: Get start, stop of capture groups
def addGroupToRegexString(str, start, end, groupsAdded):
start += groupsAdded * 2
end += groupsAdded * 2
return str[0:start] + '(' + str[start:end+1] + ')' + str[end+1:]
def fillGroups(regex):
import re
if str(type(regex)) == "<class 're.Pattern'>":
@huynhducduy
huynhducduy / binarySearch.js
Last active June 6, 2020 06:39
Algorithms & Data Structure
function binarySearch(arr, x) {
let start = 0, end = arr.length-1;
while (start <= end){
const mid = Math.floor((start + end)/2);
if (arr[mid] === x) return mid;
else if (x > arr[mid])
start = mid + 1;