Skip to content

Instantly share code, notes, and snippets.

View danielt69's full-sized avatar
:octocat:
Focusing

Daniel danielt69

:octocat:
Focusing
View GitHub Profile
@danielt69
danielt69 / gist:aed3683aa7121c2fe654d9879bb057bf
Created November 2, 2020 10:02
ps1.txt ( add to ~/.bashrc )
export PS1="\[\033[38;5;197m\]\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;14m\]\H\[$(tput sgr0)\] \t \d:\[$(tput sgr0)\]\[\033[38;5;202m\][\w]\[$(tput sgr0)\]: \[$(tput sgr0)\]"
@danielt69
danielt69 / .htaccess
Created October 12, 2020 22:03 — forked from alexsasharegan/.htaccess
Apache Config for React Router - react .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
#!/bin/bash
# Before you start this script, edit the following file: /etc/wsl.conf
#
# [automount]
# enabled = true
# options = "metadata"
#
FULL_NAME=""
@danielt69
danielt69 / manage-etc-hosts.sh
Created May 9, 2020 17:03 — forked from irazasyed/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
version: '2'
services:
wordpress:
image: wordpress:latest
networks:
- front
- back
ports:
- 8080:80
environment:
@danielt69
danielt69 / hideWPadminbar,js
Created May 10, 2019 09:16
hide wp admin bar in iframe
window.addEventListener('DOMContentLoaded', (event) => {
if (window != top) {
document.getElementsByTagName("html")[0].setAttribute('style', "margin-top: 0 !important");
document.getElementById("wpadminbar").remove();
}
});
@danielt69
danielt69 / matrixDigitalRain.js
Last active April 2, 2020 11:01
Matrix rain animation using HTML5 canvas and javascript
// https://codepen.io/P3R0/pen/MwgoKv
var matrix = (function(){
var init = function() {
document.body.style.background = 'black';
var mdr = document.createElement('canvas');
mdr.id = "mdr";
mdr.style.display = 'block';
mdr.style.position = 'fixed';
mdr.style.top = '0';
mdr.style.left = '0';
@danielt69
danielt69 / wait.js
Created November 29, 2018 11:05
a simple wait js function using Promise
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
wait(10000).then(() => saySomething("10 seconds")).catch(failureCallback);
@danielt69
danielt69 / bootstap-grid-gui-tester-bookmark.js
Last active October 31, 2018 07:19
bootstap-grid-gui-tester-bookmark
var htmlBSGrid = `
<div class="bsgrid">
<div class="container">
<h1>
<span class="visible-xs">XS: </span>
<span class="visible-sm">SM: </span>
<span class="visible-md">MD: </span>
<span class="visible-lg">LG: </span>
<span class="size"></span>
</h1>
@danielt69
danielt69 / addEventListener_passive.js
Last active May 23, 2019 12:15
a better (performance) event listener
/* Feature detection */
var passiveIfSupported = false;
try {
window.addEventListener("test", null, Object.defineProperty({}, "passive", { get: function() { passiveIfSupported = { passive: true }; } }));
} catch(err) {}
window.addEventListener('scroll', function(event) {
/* do something */
// can't use event.preventDefault();