Skip to content

Instantly share code, notes, and snippets.

View xewl's full-sized avatar
👾
Working the future

Ken Verhaegen xewl

👾
Working the future
View GitHub Profile
@AlexVanderbist
AlexVanderbist / opendb.sh
Created September 17, 2020 16:21
`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-)
@kennyeliason
kennyeliason / makewpsuck.sh
Last active May 2, 2024 07:30
Make WP Suck Less or More
#!/bin/bash
# Make sites into bedrock or normal WordPress
# Version 2.0
# Copyright (c) Kenny Eliason
set -a
source .env
set +a
@threepointone
threepointone / feature-flags.md
Last active May 24, 2023 11:03
Feature flags: why, how, all that

(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)

Feature flags

This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).

So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.

Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -

@mithicher
mithicher / pikaday-dark.css
Created May 22, 2020 14:14
Pikaday Theme - Dark version
.pikaday-dark {
--backgroundColor: #2d3748;
--textColor: #f7fafc;
--currentDateTextColor: #3182ce;
--selectedDateBackgroundColor: #3182ce;
--selectedDateTextColor: #f7fafc;
--labelTextColor: #3182ce; /* eg. May 2020 */
--weekDaysTextColor: #a0aec0; /* eg. Mo Tu We ....*/
@mithicher
mithicher / pikaday-white.css
Created May 22, 2020 14:10
Pikaday Theme - White version
.pikaday-white {
--backgroundColor: #ffffff;
--textColor: #718096;
--currentDateTextColor: #3182ce;
--selectedDateBackgroundColor: #3182ce;
--selectedDateTextColor: #ffffff;
--labelTextColor: #4a5568; /* eg. May 2020 */
--weekDaysTextColor: #a0aec0; /* eg. Mo Tu We ....*/

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

Converting Tailwind UI Alpine transitions to Vue transitions

After you copy a component from the Tailwind UI library and begin to adapt it from Vue JS to Alpine JS .. you may wonder what to do about the transitions. As I'm exploring this myself, I am documenting it for others in the same boat.

Things to be aware of:

  • Alpine calls the beginning and ending states "start" & "end"
  • Vue calls the beginning and ending states "from" and "to"
  • Alpine has inline "directives" ie x-transition:enter="classes"
  • Vue has a wrapper component that applies classes to the child
  • Alpine applies the classes you pass it for each state, :enter-start="class"
@cvan
cvan / tailwind.config.js
Last active February 2, 2024 18:39
tailwind CSS breakpoints (including iPhone 11 Pro Max)
// References used:
// - https://yesviz.com/devices.php
// - https://ricostacruz.com/til/css-media-query-breakpoints
// - https://tailwindcss.com/docs/responsive-design/#customizing-breakpoints
screens: {
'2xs': { min: '300px' },
xs: { max: '575px' }, // Mobile (iPhone 3 - iPhone XS Max).
sm: { min: '576px', max: '897px' }, // Mobile (matches max: iPhone 11 Pro Max landscape @ 896px).
md: { min: '898px', max: '1199px' }, // Tablet (matches max: iPad Pro @ 1112px).
lg: { min: '1200px' }, // Desktop smallest.
@edwardlorilla
edwardlorilla / index.html
Created October 12, 2019 14:52
multiline Seconds to Hours:Minutes:Seconds vuejs
<div id="app">
<textarea name="second" id="second" cols="30" rows="10" v-model="second"></textarea>
<textarea v-model="secondToHMS" name="hms" id="hms" cols="30" rows="10"></textarea>
</div>
@cyberwani
cyberwani / wordpress-upload-base64.php
Created September 13, 2019 10:19
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;