Many of the more "advanced" typescript features can be used for creating "value-derived" types.
At its simplest form:
let vehicle = { name: "Van", wheels: 4 }
<!DOCTYPE html> | |
<html lang="en" class="dark"> | |
<head><!-- head stuff --></head> | |
<body class="h-screen bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-grey-200 font-sans transition transition-colors ease-out"> | |
<main role="main" class="container mx-auto"> | |
<div x-data="{text: ['Light', 'Dark']}"> | |
<button | |
class="border p-2 font-bold bg-gray-900 dark:bg-white text-white dark:text-grey-900" | |
@click="document.documentElement.classList.toggle('dark'); text = text.reverse()" | |
x-text="text[0]" |
PORTAL_DOMAIN=localhost | |
SESSION_DRIVER=shared |
const Webpackbar = require('webpackbar') | |
module.exports = { | |
webpack: (config, { isServer }) => { | |
config.plugins.push(new Webpackbar({ name: isServer ? 'server' : 'client' })) | |
return config | |
} | |
} |
<div x-data="{ bankAccounts: [{ | |
id: '', | |
accountNumber: '' | |
}] }"> | |
<template x-for="(bankAccount, index, bankAccounts) in bankAccounts" :key="index"> | |
<div class="grid grid-cols-6 gap-6 mt-2"> | |
<div class="col-span-3 md:col-span-3 sm:col-span-2"> | |
<x-jet-label for="city">Bank</x-jet-label> | |
<select :name="`bank_info[${index}][bank_id]`" id="bank" | |
class="border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm mt-1 block w-full"> |
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class MigrateToJetstream extends Migration | |
{ | |
public function up() | |
{ |
@props([ | |
'percentage' => 0, | |
'failed' => false | |
]) | |
@php | |
$done = $failed || $percentage == 100; | |
@endphp | |
<div {{ $attributes->merge(['class' => ' space-y-1'])->whereDoesntStartWith('wire:poll') }} |
// Demo; https://codepen.io/KevinBatdorf/pen/RwGEdpr?editors=1011 | |
// Load in before you load Alpine | |
function AlpineAutoInitChildren() { | |
// Use: <div x-data x-init="$initChildren()"> | |
Alpine.addMagicProperty('initChildren', ($el) => { | |
return () => { | |
// Grab all child x-init. Customize if you want to only run based on a specific condition | |
Array.from($el.querySelectorAll('[x-init]')).forEach(child => { | |
# Install the latest wsl2 with systemd support | |
# https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/ | |
# Update the latest wsl | |
wsl --update --web-download | |
# Install Ubuntu with username vagrant | |
wsl --install -d Ubuntu-20.04 | |
# Set Ubuntu as default distro |
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e | |
// by @levelsio | |
// HOW TO | |
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1 | |
// 2) Publish your Google Sheet, File -> Publish To Web | |
// 3) Copy the SHEET_ID in the URL, put it in here below: | |
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" | |
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 | |
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc) |