Skip to content

Instantly share code, notes, and snippets.

View ryangjchandler's full-sized avatar
💭
I may be slow to respond.

Ryan Chandler ryangjchandler

💭
I may be slow to respond.
View GitHub Profile
import "http" exposing HttpServer, Request, Response
function main() {
HttpServer.get("/", func (req Request, res Response) => {
return res.Send("Hello!")
})
HttpServer.listen(8080)
}
// 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")
}
// 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")
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Post extends Model
{
public static function boot()
<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) => ({
@ryangjchandler
ryangjchandler / README.md
Last active September 25, 2023 23:56
Tailwind Palette to CSS Variables

Tailwind Shades to CSS Variables

This script can be used to generate a set of CSS variables from a Tailwind shades object.

Overview

Let's say you have the following JavaScript object. You might have generated such an object on a site such as Tailwind Shades.

{
@ryangjchandler
ryangjchandler / README.md
Last active June 23, 2023 08:22
Raycast - Laravel Documentation

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 / index.ts
Created September 16, 2021 13:21
Typescript Optional<T> type (Rust-esque)
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 / pxp.tmLanguage.json
Created July 24, 2023 16:00
PXP Language Grammar
{
"scopeName": "source.pxp",
"patterns": [
{
"include": "#attribute"
},
{
"include": "#comments"
},
{
@ryangjchandler
ryangjchandler / code.php
Created September 10, 2023 18:37
Syntax Highlighting Kitchen Sink
<?php
namespace Sample;
class SampleClass implements SampleInterface
{
public string $public;
protected SampleClass $protected;