Skip to content

Instantly share code, notes, and snippets.

@akoepcke
akoepcke / readDuration.php
Created May 7, 2021 19:07 — forked from owenvoke/readDuration.php
A string macro for the duration to read text.
<?php
// From Marcel Pociot's tweet
// See: https://twitter.com/marcelpociot/status/1389881758267625473
Str::macro('readDuration', function (... $text) {
$totalWords = str_word_count(implode(' ', $text));
$minutesToRead = round($totalWords / 200);
return (int) max(1, $minutesToRead);
@akoepcke
akoepcke / tailwind.config.js
Created April 17, 2021 21:39 — forked from samselikoff/tailwind.config.js
Firefox plugin for Tailwind CSS. Add styles that target Firefox browser only.
const plugin = require("tailwindcss/plugin");
module.exports = {
mode: "jit",
purge: {
content: ["./src/**/*.{js,ts,jsx,tsx,mdx,vue}"],
},
theme: { extend: {} },
variants: {},
plugins: [
@akoepcke
akoepcke / bigger-tailwindcss-spacing-scale.js
Created January 18, 2021 09:59 — forked from vivgui/bigger-tailwindcss-spacing-scale.js
Here's a bigger spacing scale for TailwindCSS.
spacing: {
"13": '3.25rem',
"15": '3.75rem',
"17": '4.25rem',
"18": '4.5rem',
"19": '4.75rem',
"76": "19rem",
"84": "21rem",
"88": "22rem",
"92": "23rem",
@akoepcke
akoepcke / App.js
Created January 4, 2021 15:58 — forked from daankauwenberg/App.js
A React cookie consent using hooks and context
import React from 'react';
import { CookieConsentProvider } from './CookieConsent'
import Page from './Page'
function App() {
return (
<CookieConsentProvider>
<div className="App">
<Page />
</div>
@akoepcke
akoepcke / gist:3f026b8588e67a755c5036c7c01bb981
Created October 16, 2020 16:30 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@akoepcke
akoepcke / opendb.sh
Created September 21, 2020 17:49 — forked from AlexVanderbist/opendb.sh
`opendb` command - opens the database for a Laravel app in your GUI
opendb () {
[ ! -f .env ] && { echo "No .env file found."; exit 1; }
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
/* Apply a default duration to all .transition classes */
[class*="transition"] {
@apply duration-300;
}
/* Default transition class must come _before_ utilities,
so it can be overridden by any .duration-x utilities */
@tailwind utilities;
@akoepcke
akoepcke / gitmoji-cheatsheet.md
Created February 23, 2020 16:16 — forked from guillermocalvo/gitmoji-cheatsheet.md
Gitmoji Cheatsheet

Gitmoji Cheatsheet

Repository

  • 🎉 Initial commit
  • ⏪ Reverting changes
  • 🔀 Merging branches
  • 🙈 Adding or updating a .gitignore file
@akoepcke
akoepcke / twittermute.txt
Created January 24, 2020 19:19 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@akoepcke
akoepcke / RouteDirectives.php
Created January 23, 2020 16:16 — forked from calebporzio/RouteDirectives.php
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";