Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dsdsdsdsdsds
dsdsdsdsdsds / scrollbar.scss
Created September 8, 2023 07:20
Scrollbar SASS mixin
@mixin scrollbars(
$size: 10px,
$foreground-color: white,
$background-color: black
) {
// For Chrome & Safari
&::-webkit-scrollbar {
width: $size;
height: $size;
}
@dsdsdsdsdsds
dsdsdsdsdsds / ready.php
Created November 10, 2019 12:52
ProcessWire: Hide non-editable pages in the page tree
<?php namespace ProcessWire;
// Taken from https://processwire.com/talk/topic/22369-hide-uneditable-pages-in-admin-treeprocesspagelist/?tab=comments#comment-191963
$this->addHookAfter('ProcessPageList::find', function(HookEvent $event) {
$pages = $event->return;
$excludePagesByTemplate = array('admin', 'basic-page');
$pages->each(function($p) use($pages, $excludePagesByTemplate) {
if(!in_array($p->template, $excludePagesByTemplate)) return;
@dsdsdsdsdsds
dsdsdsdsdsds / app.html
Last active October 30, 2019 12:46
Customize Snipcart 3.0 cart
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.1/default/snipcart.css" />
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
<div id="snipcart" data-api-key="" hidden>
<item-line>
@dsdsdsdsdsds
dsdsdsdsdsds / contain.js
Created July 29, 2019 08:24
Scale element to be always contained within container
function contain(element, container) {
const scale = Math.min(
container.offsetWidth / element.offsetWidth,
container.offsetHeight / element.offsetHeight
)
return scale
}
@dsdsdsdsdsds
dsdsdsdsdsds / easing.js
Created May 2, 2019 13:23 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@dsdsdsdsdsds
dsdsdsdsdsds / .htaccess
Last active December 17, 2017 09:20
Rewrite domain.com/dist/ to domain.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC,OR]
RewriteCond %{REQUEST_URI} !dist/
RewriteRule (.*) /dist/$1 [L]
@dsdsdsdsdsds
dsdsdsdsdsds / list.scss
Last active August 14, 2017 21:10
CSS: Custom bullet point for <ul> list
ul {
position: relative;
margin-left: 0;
padding-left: 1em;
list-style-type: none;
li {
&:before {
content: "?";
@dsdsdsdsdsds
dsdsdsdsdsds / cursor.css
Last active November 1, 2023 11:45
CSS: Cross Browser hires/retina cursor image
.cursor {
cursor: url("cursor.png") 0 0, pointer; /* Legacy */
cursor: url("cursor.svg") 0 0, pointer; /* FF */
cursor: -webkit-image-set(url("cursor.png") 1x, url("cursor@2x.png") 2x) 0 0, pointer; /* Webkit */
}