Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

chautran tranchausky

🏹
done
View GitHub Profile
(function() {
var script = document.createElement('script');
script.onload = function() {
var stats = new MemoryStats();
var elem = stats.domElement;
elem.style.position = 'fixed';
elem.style.right = '0px';
elem.style.bottom = '0px';
javascript:(function(){var script=document.createElement('script');script.src='https://rawgit.com/paulirish/memory-stats.js/master/bookmarklet.js';document.head.appendChild(script);})()
@tranchausky
tranchausky / bootstrap-view-only-desktop-or-mobile.html
Created October 14, 2022 09:13
bootstra4 view desktop, or view in mobile
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
@tranchausky
tranchausky / appen.js
Created October 16, 2022 18:10
Javascript append array
const arr1 = ['a', 'b'];
const arr2 = ['c', 'd'];
const arr3 = arr1.concat(arr2);
console.log(arr3); // 👉️ ['a', 'b', 'c', 'd']
//https://bobbyhadz.com/blog/javascript-append-one-array-to-another-array
@tranchausky
tranchausky / css_order_coulmn.html
Created October 17, 2022 03:56
css change order div in in row, or in cloumn
<!DOCTYPE html>
<html>
<head>
<style>
#main {
width: 100%;
height: 150px;
border: 1px solid #c3c3c3;
display: -webkit-flex; /* Safari */
display: flex;
@tranchausky
tranchausky / change_URL.js
Created October 17, 2022 11:13
javascript change URL parameter and hold parameter
//http://localhost/news/?feed=9&adsfa=1
//http://localhost/news/?feed=8&adsfa=1
//seturlNew('feed', id);
function seturlNew(key,value){
var t = new URLSearchParams(document.location.search);
t.set(key, value);
var n = window.location.pathname + "?" + t.toString();
window.history.pushState(null, "", n);
@tranchausky
tranchausky / jquery_has_scroll.js
Created October 17, 2022 11:14
jquery function check had scroll for element
//https://stackoverflow.com/a/4814526
(function($) {
$.fn.hasScrollBar = function() {
return this.get(0).scrollHeight > this.get(0).clientHeight;
}
})(jQuery);
//use
@tranchausky
tranchausky / date-now-to-utc.js
Created October 17, 2022 16:29
Javascript date now to utc (int)
var now = new Date();
var utc = new Date(now.getTime() + now.getTimezoneOffset() * 60000);
///utc(int)
//https://stackoverflow.com/a/11964609
@tranchausky
tranchausky / different time.js
Created October 17, 2022 16:30
different time javascript
function fromNow(date, nowDate = Date.now(), rft = new Intl.RelativeTimeFormat(undefined, { numeric: "auto" })) {
const SECOND = 1000;
const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
const WEEK = 7 * DAY;
const MONTH = 30 * DAY;
const YEAR = 365 * DAY;
const intervals = [
{ ge: YEAR, divisor: YEAR, unit: 'year' },
@tranchausky
tranchausky / index.html
Created October 18, 2022 02:49
dynamic load css js
<html>
<head>
<script>
//http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
var glb_version = 'v=1234zd';
</script>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>