Skip to content

Instantly share code, notes, and snippets.

View aolko's full-sized avatar
📧
Wanna talk? Use twitter/discord

aolko

📧
Wanna talk? Use twitter/discord
View GitHub Profile
@brlodi
brlodi / _scss-color-range-generator.md
Last active February 14, 2024 14:30
A set of Sass functions to automatically create Material Design-style color ranges, for when you don't want to have to manually spec out a full set of shades and tints for every color in your design.

About

These functions use one or two 'base' colors to automatically generate a color range similar to Material Design's color ranges. Useful to quickly get different shades of your primary brand color or accent color, or to generate a set of neutrals between hand-selected light and dark colors.

Usage

$greens: make-shades(#cc99cc);
// (
//   100: #eeddee,
// 200: #ddbbdd,
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 10, 2024 20:23
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@hopsoft
hopsoft / prefetch.js
Last active December 27, 2023 02:45
Turbolinks Prefetching
const hoverTime = 400
const fetchers = {}
const doc = document.implementation.createHTMLDocument('prefetch')
function fetchPage (url, success) {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.setRequestHeader('VND.PREFETCH', 'true')
xhr.setRequestHeader('Accept', 'text/html')
xhr.onreadystatechange = () => {
@moo-im-a-cow
moo-im-a-cow / anotherroute.php
Last active September 3, 2018 18:13
klein.php subdomain matching
<?php
$this->respond(
'/?', function ($req, $res, $service, $app) {
return "home page for SUBDOMAIN";
}
);
@notjuliee
notjuliee / nosteponcss.js
Created May 8, 2017 03:41
No step on CSS
// ==UserScript==
// @name RedaddCSS
// @namespace com.digitalfishfun.nosteponcss
// @version 1
// @grant none
// @include https://reddit.com/r/*
// ==/UserScript==
const nosteponcss_instructions = `
USAGE:
@rambabusaravanan
rambabusaravanan / detect-js-framework.js
Last active April 25, 2024 11:31
Detect JS Framework used in a Website
// Paste these lines into website's console (Win/Linux: Ctrl + Shift + I / Mac: Cmd + Alt + I)
if(!!window.React ||
!!document.querySelector('[data-reactroot], [data-reactid]') ||
Array.from(document.querySelectorAll('*')).some(e => e._reactRootContainer !== undefined || Object.keys(e).some(k => k.startsWith('__reactContainer')))
)
console.log('React.js');
if(!!document.querySelector('script[id=__NEXT_DATA__]'))
console.log('Next.js');
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@munchicken
munchicken / htaccess
Last active December 16, 2022 10:56 — forked from dave1010/htaccess
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config originally created by @dave1010,
# rebuilt by Sarah Pierce (see modifications section)
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
@jondaiello
jondaiello / _arrows.scss
Last active February 22, 2024 15:18
SASS @mixin for Arrows
// Demo at http://codepen.io/jondaiello/full/YWRbOx/
/* This mixin is for generating CSS arrows on a box */
@mixin box-arrow($arrowDirection, $arrowColor, $arrowSize: 10px) {
position: relative;
z-index: 10;
&::after {
content: '';
width: 0;
height: 0;
@allenmoore
allenmoore / README.md
Last active April 16, 2019 22:12 — forked from jonathantneal/README.md
CSS Modules in PHP

CSS Modules lets you write and use simple class names rather than remembering and maintaining long unique class names for every component. CSS Modules mutates all of your classnames from each partials into new, completely unique classnames that will not conflict when they are bundled together into your main CSS file. Then, a JSON file is generated that maps the happy classnames from each file to the unique classname in the combined file. You load this map in PHP, and begin using the easy-to-remember classnames as you wish.