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
@rambabusaravanan
rambabusaravanan / detect-js-framework.js
Last active May 10, 2024 14:34
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');
@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:
@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";
}
);
@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 = () => {
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 15, 2024 20:11
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;
}
@james2doyle
james2doyle / sqlite-api.php
Created May 12, 2019 21:27
Turn Sqlite into a public, read-only, JSON API
<?php
function json_response(int $code = 200, array $data = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header('Cache-Control: public, max-age=300');
@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,