Skip to content

Instantly share code, notes, and snippets.

View charisTheo's full-sized avatar
⚛️
Reacting

Harry Theo charisTheo

⚛️
Reacting
View GitHub Profile
@charisTheo
charisTheo / box-shadow.css
Last active February 21, 2019 20:09
Browser support for box-shadow CSS property
box-shadow: 0 3px 16px 0 rgba(0,0,0,.6);
-o-box-shadow: 0 3px 16px 0 rgba(0,0,0,.6);
-ms-box-shadow: 0 3px 16px 0 rgba(0,0,0,.6);
-moz-box-shadow: 0 3px 16px 0 rgba(0,0,0,.6);
-webkit-box-shadow: 0 3px 16px 0 rgba(0,0,0,.6);
@charisTheo
charisTheo / background.css
Created October 28, 2018 11:01
Browser support for background CSS property
/* Syntax */
/* background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit; */
-webkit-background: /* add values */;
-moz-background: /* add values */;
-ms-background: /* add values */;
-o-background: /* add values */;
background: /* add values */;
@charisTheo
charisTheo / media.css
Created October 28, 2018 11:04
CSS Media Queries
/* Extra small devices and above */
@media only screen and (min-width: 319px) {
/* content; */
}
/* Small devices and above */
@media only screen and (min-width: 479px) {
/* content; */
}
@charisTheo
charisTheo / normalize.css
Created October 28, 2018 11:07
Normalize CSS styles
html {
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
@charisTheo
charisTheo / scroll-bar.css
Last active December 6, 2019 12:20
Scroll bar custom CSS styles for Chrome
*::-webkit-scrollbar {
width: 5px;
height: 5px;
opacity: 0.35;
-webkit-transition: all 0.35s;
-moz-transition: all 0.35s;
-ms-transition: all 0.35s;
-o-transition: all 0.35s;
transition: all 0.35s;
}
@charisTheo
charisTheo / selection.css
Created October 28, 2018 11:10
Text and Image Selection CSS property
::selection {
background-color: #aa00ff;
text-shadow: none;
color: #151515;
}
::-moz-selection {
background-color: #aa00ff;
text-shadow: none;
color: #151515;
}
@charisTheo
charisTheo / sw.js
Created October 28, 2018 11:18
Service Worker Template
// use a cacheName for cache versioning
var cacheName = 'v1:static';
// during the install phase you usually want to cache static assets
self.addEventListener('install', function(e) {
// once the SW is installed, go ahead and fetch the resources to make this work offline
e.waitUntil(
caches.open(cacheName).then(function(cache) {
return cache.addAll([
'./styles/css/',
@charisTheo
charisTheo / manifest.json
Last active December 12, 2019 18:21
Web App Manifest JSON file for Chrome
{
"short_name": "Web app short name",
"name": "Web app name",
"description": "Web app description",
"start_url": ".",
"display": "standalone",
"background_color": "#aa00ff",
"theme_color": "#76ff03",
"lang": "en-GB",
"icons": [
@charisTheo
charisTheo / manifest.webmanifest
Last active December 12, 2019 18:21
Web app Manifest file for Firefox
{
"short_name": "Web app short name",
"name": "Web app name",
"description": "Web app description",
"start_url": ".",
"display": "standalone",
"background_color": "#aa00ff",
"theme_color": "#76ff03",
"lang": "en-GB",
"icons": [
@charisTheo
charisTheo / service-worker-push-registration.js
Last active January 6, 2020 17:08
Register Service Worker on the front-end and request Push Permission
if ('serviceWorker' in navigator) { // || 'ServiceWorker' in window
sw();
}
function sw() {
const registration = navigator.serviceWorker.register('/sw.js', {scope: '/'})
.then(function(_registration) {
console.log('Registration succeeded. Scope is ' + _registration.scope);
// request push notification permission only when user clicks the notification button as a good practise
$('#notifications-button').on("click", function() {