Skip to content

Instantly share code, notes, and snippets.

View agusputra's full-sized avatar
🏠
Working from home

Agus Syahputra agusputra

🏠
Working from home
View GitHub Profile
@agusputra
agusputra / scrollToSelector.js
Created May 17, 2016 05:06
scrollToSelector.js
window.scrollToSelector = function scrollToSelector(selector) {
$('html, body').animate({
scrollTop: $(selector).offset().top
}, 1000);
};
@agusputra
agusputra / Bootstrap-Utilities.css
Last active August 10, 2016 05:32
Bootstrap-Utilities.css
@media all and (max-width: 767px) {
.xs-padding-0 {
padding: 0;
}
.xs-padding-left-0 {
padding-left: 0;
}
.xs-padding-right-0 {
@agusputra
agusputra / Simple_html_template_system.php
Created August 10, 2016 08:31
Simple_html_template_system.php
<?php
ob_start();
include('./template/index.php');
echo ob_get_clean();
/* Modified from: https://css-tricks.com/dont-overthink-it-grids/ */
.row {
margin: 0 -20px;
}
.row:after {
content: "";
display: table;
clear: both;
0x03De52113EA16E78b807905EF76D2323598E61c5
@agusputra
agusputra / getUtf8Bytes.js
Created October 14, 2017 10:06
Get UTF-8 bit/byte representation of unicode character in JS
new TextEncoder('utf-8').encode('\u0001')
new TextEncoder('utf-8').encode('\uffff')
@agusputra
agusputra / allMatches.js
Created January 5, 2019 07:10
Get all matches when using regex
function allMatches (regex, text) {
if (!regex.global) throw new Error('option global not set')
let matches = []
while(true) {
const match = regex.exec(text)
if (!match) break;
matches.push(match)
}
@agusputra
agusputra / bs-utils.scss
Created January 5, 2019 07:21
Utils for bootstrap
@mixin when-xs {
@media all and (max-width: 575px) {
@content
}
}
@mixin when-sm {
@media all and (min-width: 576px) and (max-width: 767px) {
@content
}
@agusputra
agusputra / Bootstrap-Grid-System.css
Last active November 3, 2019 09:34
Bootstrap Grid System
/**/
/* Min Width */
/**/
@media (min-width: 0) {
}
@media (min-width: 576px) {
@agusputra
agusputra / do-if.js
Created November 3, 2019 09:32
do-if.js
function doIf(predicate, callback, timeOut) {
setTimeout(() => {
if (predicate()) {
callback()
}
else {
doIf(predicate, callback);
}
}, timeOut)
}