Skip to content

Instantly share code, notes, and snippets.

View dwaard's full-sized avatar

Daan de Waard dwaard

  • HZ University of Applied Sciences
  • Middelburg, Netherlands
View GitHub Profile
@if ($paginator->hasPages())
<nav class="pagination flex justify-center" role="navigation" aria-label="pagination">
{{-- Previous Page Link --}}
<a class="pagination-previous mr-2 {{ $paginator->onFirstPage() ? 'opacity-50 cursor-not-allowed' : 'bg-white dark:bg-gray-700 text-indigo-700 dark:text-gray-200 hover:text-gray-500 hover:bg-gray-100 dark:hover:text-gray-200 dark:hover:bg-gray-900' }} px-4 py-2 rounded-md border border-gray-300 dark:border-gray-700 text-gray-700"
href="{{ $paginator->previousPageUrl() }}">
@lang('pagination.previous')
</a>
{{-- Pagination Elements --}}
<ul class="pagination-list flex space-x-2 mt-2">
@dwaard
dwaard / robot_car_test.ino
Created July 6, 2023 10:43
Grove motor driver example
#include "Grove_Motor_Driver_TB6612FNG.h"
#include <Wire.h>
MotorDriver motor;
#define FWD 128
#define BCK -FWD
double radians;
@dwaard
dwaard / wysiwyg.blade.php
Last active April 3, 2023 08:18
Laravel Bulma Component that includes a CKEditor 5 based WYSIWYG editor
@props(['value' => '', 'name', 'height' => 400])
<div>
<textarea id="ckeditor-{{ $name }}" name="{{ $name }}" {{ $attributes->merge(['class' => 'textarea']) }} >{!! $value !!}</textarea>
</div>
@push('scripts')
<script src="https://cdn.ckeditor.com/ckeditor5/35.1.0/classic/ckeditor.js"></script>
<script>
ClassicEditor
@dwaard
dwaard / modal-form.blade.php
Created March 8, 2023 15:24
Laravel Bulma Basic Modal Component that includes a form
@props(['name', 'trigger', 'title', 'submit' => 'Submit', 'type' => 'light', 'reset' => false])
<div>
{{-- The button that triggers the modal. The Trigger slot is responsible for the content --}}
<button {{ $trigger->attributes->class(['button', 'js-modal-trigger']) }} data-target="modal-{{ $name }}">
{{ $trigger }}
</button>
{{-- The modal itself. The name attribute should make each modal unique in the page --}}
<div class="modal" id="modal-{{ $name }}">
@dwaard
dwaard / app.ts
Last active January 11, 2023 10:46
Experiments with the Locale class
// Experiments with the browser locale
console.log(Locale.getAvailableBrowserLocales());
// Experiments with instantiating locales
let language = Locale.getCurrentBrowserLocale();
language = 'sv';
// language = 'hu-HU';
// language = 'nl';
const locale = new Locale(language);
@dwaard
dwaard / Locale.ts
Last active January 8, 2024 11:09
Typescript class for Locale specific funcionality
/**
* A class that represents a locale. It can be used to translate strings, format
* dates and numbers and other locale specific tasks.
*
* To use this class, you need to create a JSON file in the `assets/lang`
* directory of your project. The filename should be the RFC5646 language tag
* of the language you want to support. For example, if you want to support
* English, you should create a file named `en.json`. If you want to support
* Dutch, you should create a file named `nl.json`. If you want to support
* American English, you should create a file named `en-US.json`.
@dwaard
dwaard / CsvReadable.php
Last active May 23, 2023 19:35
Csv Readable Trait for Laravel Seeders. Including an example seeder file
<?php
namespace Database\Seeders;
use Illuminate\Support\Facades\Storage;
/**
* Trait that enables Seeder classes to easily read CSV formatted files and seed Models with its data. The
*
* User: waar0003
@dwaard
dwaard / docker-compose.yml
Created June 10, 2022 13:24
Add PHPMyAdmin service to you Laravel Sail configuration
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
PMA_USER: '${DB_USERNAME}'
PMA_PASSWORD: '${DB_PASSWORD}'
restart: always
@if ($paginator->hasPages())
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
{{-- Previous Page Link --}}
<a class="pagination-previous" {{ $paginator->onFirstPage() ? "disabled" : "" }}
href="{{ $paginator->previousPageUrl() }}">
@lang('pagination.previous')
</a>
<a class="pagination-next" {{ $paginator->hasMorePages() ? "" : "disabled" }}
href="{{ $paginator->nextPageUrl() }}">
@dwaard
dwaard / GameLoop.ts
Last active November 29, 2021 14:22
An improved version of an implementation of a generic Game Loop. It uses Inheritance to specify a Scene class that the gameloop animates.
import Scene from './Scene.js';
/**
* Represents a basic Game Loop based on `requestAnimationFrame()`.
*
* The implementation of this class depends on another class: `Scene`. This
* means that, if you use this class, you must have a class that is a subclass
* of `Scene` that overides the three methods `processInput()`, `update(elapsed)`
* and `render()`.
*