Skip to content

Instantly share code, notes, and snippets.

View alexrintt's full-sized avatar

Alex alexrintt

View GitHub Profile
@alexrintt
alexrintt / darkmode.js
Last active January 21, 2020 22:14
script that implements a window api to control the user's choice of theme with localstorage support and without the flash bug
//window.__theme: variable with the current theme: "dark" or "light"
//window.__setPreferredTheme: function that receives the new theme to be applied
//window.__onThemeChange: function that will be called every time the theme changes
(function() {
window.__onThemeChange = function() {};
function setTheme(newTheme) {
window.__theme = newTheme;
preferredTheme = newTheme;
document.body.className = newTheme;
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap');
font-family: 'Josefin Sans', sans-serif;
@import url('https://fonts.googleapis.com/css?family=Courier+Prime&display=swap');
font-family: 'Courier Prime', monospace;
index.js
if (process.env.DEVELOPMENT) {
const ngrok = require("ngrok");
(async function() {
try {
const url = await ngrok.connect({
proto: "http",
addr: process.env.PORT
});
console.log("Tunnel Created -> ");
rel="noopener noreferrer external"
function randomIntFromInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
export default function copyToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed'; //avoid scrolling to bottom
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
}
animation: example 5s linear 2s infinite alternate;
@alexrintt
alexrintt / metatags.html
Last active February 13, 2020 00:49
Useful meta tags
<html>
<head>
<!--Recommended Meta Tags-->
<meta charset="utf-8">
<meta name="language" content="english">
<meta http-equiv="content-type" content="text/html">
<meta name="author" content="Laks Castro">
<meta name="designer" content="Laks Castro">
<meta name="publisher" content="Laks Castro">
<meta name="no-email-collection" content="http://www.unspam.com/noemailcollection/">
<a class="icon-container" target="_blank" rel="noopener noreferrer external" href="https://mail.google.com/mail/u/0/?view=cm&fs=1&to=aparecidolucas267@gmail.com&tf=1"></a>