Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Ryan Chandler ryangjchandler

💭
I may be slow to respond.
View GitHub Profile
@ryangjchandler
ryangjchandler / code.php
Created September 10, 2023 18:37
Syntax Highlighting Kitchen Sink
View code.php
<?php
namespace Sample;
class SampleClass implements SampleInterface
{
public string $public;
protected SampleClass $protected;
@ryangjchandler
ryangjchandler / pxp.tmLanguage.json
Created July 24, 2023 16:00
PXP Language Grammar
View pxp.tmLanguage.json
{
"scopeName": "source.pxp",
"patterns": [
{
"include": "#attribute"
},
{
"include": "#comments"
},
{
@ryangjchandler
ryangjchandler / index.ts
Created September 16, 2021 13:21
Typescript Optional<T> type (Rust-esque)
View index.ts
type Option<T> = Some<T> | None<T>;
interface Optional<T> {
unwrap(): T;
unwrapOr(or: T): T;
isSome(): boolean;
isNone(): boolean;
}
class Some<T> implements Optional<T> {
@ryangjchandler
ryangjchandler / README.md
Last active June 23, 2023 08:22
Raycast - Laravel Documentation
View README.md

Raycast - Laravel Documentation

This script command provides a quick way of searching the Laravel documentation.

It accepts a query and will open the first result in your default browser.

Installation

  1. Begin by creating a ~/.config/raycast/scripts folder if you don't already have one.
@ryangjchandler
ryangjchandler / README.md
Last active July 17, 2023 16:54
Tailwind Palette to CSS Variables
View README.md
View example.html
<div x-data="example()">
<template x-for="(item, i) in items" :key="i">
<div x-bind="props(i)"></div>
</template>
</div>
<script>
const example = () => ({
current: 0,
items: [1, 2, 3],
props: (i) => ({
View PostModelEvents.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Post extends Model
{
public static function boot()
View class.eu
// module name shoild follow folders, like PSR-4
module controllers
import "http" exposing Request, Response
export class HelloController {
exposed function handle(req Request, res Response) {
return res.send("Hello")
}
View class.eu
// module name shoild follow folders, like PSR-4
module controllers
import "http" exposing Request, Response
export class HelloController {
exposed function handle(req Request, res Response) {
return res.send("Hello")
}
View hello.eu
import "http" exposing HttpServer, Request, Response
function main() {
HttpServer.get("/", func (req Request, res Response) => {
return res.Send("Hello!")
})
HttpServer.listen(8080)
}