Skip to content

Instantly share code, notes, and snippets.

View benbjurstrom's full-sized avatar

Ben Bjurstrom benbjurstrom

View GitHub Profile
@innocenzi
innocenzi / inertia-layout.ts
Last active October 27, 2022 07:34
Laravel domain-driven front-end with Vite
import type { Plugin } from 'vite'
const PLUGIN_NAME = 'vite:inertia:layout'
const TEMPLATE_LAYOUT_REGEX = /<template +layout(?: *= *['"](?:(?:(\w+):)?(\w+))['"] *)?>/
export default (): Plugin => ({
name: PLUGIN_NAME,
transform: (code: string) => {
if (!TEMPLATE_LAYOUT_REGEX.test(code)) {
return
@dannberg
dannberg / obsidian-daily-note-template.txt
Last active March 23, 2024 12:54
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
@katspaugh
katspaugh / README.md
Last active August 29, 2023 06:50
Draw text on Unicorn Hat with Raspberry Pi Pico

Drawing text on a Unicorn Hat

The Pimoroni Unicorn Hat comes with a handy MicroPython SDK. To use it, you need to download Pimoroni's fork of MicroPython that includes the Unicorn library, and upload it to Raspberry Pi Pico. Boot it with the button pressed and drag-n-drop the uf2 file to the disk that will appear on your computer. After that you can upload any Python script to that disk and it will run automatically if it's called main.py.

The Unicorn library has a function called picounicorn.set_pixel that lets you set the color of an individual LED. We take advantage of this function to draw characters using a 5x7 font. Each character is represented by 5 bytes, one per vertical row of pixels (or LEDS).

See https://github.com/Ameba8195/Arduino/blob/master/hardware_v2/cores/arduino/font5x7.h for details.

Temperature sensor

@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active February 25, 2024 07:15
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 20, 2024 21:24
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@sergomet
sergomet / GoogleDriveServiceProvider.php
Created April 1, 2017 07:01 — forked from ivanvermeyen/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.

The Laracasts PHPStorm theme - modified.

This is a slightly modified version of the great Laracasts PHPStorm theme. I've added some styles for Verions Control (add, modified, deleted line...) and fixed some missing things like warnings.

Download

image

Mac: Add to ~/Library/Preferences/WebIde80/colors

@ryane
ryane / five_minutes.yml
Created February 24, 2015 15:15
five_minutes.yml
---
- hosts: all
vars:
UBUNTU_COMMON_ROOT_PASSWORD: 'xxxxx'
UBUNTU_COMMON_DEPLOY_PASSWORD: 'xxxxx'
UBUNTU_COMMON_LOGWATCH_EMAIL: user@example.com
ubuntu_common_deploy_user_name: deploy
ubuntu_common_deploy_public_keys:
- ~/.ssh/id_rsa.pub
@denji
denji / README.md
Last active January 30, 2024 12:21 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
@mischah
mischah / z.md
Last active December 9, 2022 02:11
Installing und initializing z (https://github.com/rupa/z) with help of Homebrew.

#The power of z

Do you spend lots of time doing things like this?

cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwant

With z, you could just do this: