Skip to content

Instantly share code, notes, and snippets.

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

Christopher Pitt assertchris

💭
I may be slow to respond.
View GitHub Profile
@assertchris
assertchris / gist:2577836
Created May 2, 2012 16:09
Highlight lines in Ace (Editor)
###
CoffeeScript
marker = null;
require(["ace/range"], (range) ->
marker = editor.getSession().addMarker(new range.Range(7, 0, 7, 2000), "warning", "line", true);
)
setTimeout(->

Board game club synopsis

My son wants to make board games, and I want to be involved in more social groups. To this end, I would like to join (or start) a group around the theme of making board games. I am still working out the finer details, but the general idea is:

  • We read a couple books on the subject, and share our thoughts on them (2-4 weeks, depending on the books)
  • Gather to share final thoughts and talk about first ideas
  • We plan as many aspects of our individual games as possible; including things like theme and rules (6 weeks, gathering every couple of weeks to show progress)
  • We implement as many aspects of our games as possible; including things like art, construction, and print (6 weeks, gathering every couple of weeks to show progress)
  • We have 1 (or more) “games nights” where we play each game and give feedback.
<?php
$converter->when(
fn(Heading $node) => // => reflection-based overloading
HtmlElement::fromString( // => complex types from string template syntax
'<h1 class="font-2xl">:text</h1>',
['text' => $node->text]
)
);
<?php
namespace Tests\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

I'd like to share a complex Livewire + Alpine component I've made. I can piece together all the things I need to do to release it from a backend perspective. This includes things like an auto-discoverable service provider, custom Livewire component registration etc.

The difficulty I am having is that I want to write the JS for this component away from the view so that the view is easy to customise. Instead of x-data="{...}", I'd like to do soemthing like x-data="SearchTagField", and have all the gubbins of this Alpine component live in a JS file somewhere else.

I can't seem to find a good way to do this.

I think of what it must be like to ship this JS file with my library. To require the consumer to import '../../vendor/x/y/dist/Component' and I throw up a little in my mouth. I could tell the consumer what to customise in Webpack or [Vite](https://stackoverflow.com/questions/68217795/vite-resolve-alias-

<?php
namespace Tests\Feature;
use App\Models\MyModel;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AuthMiddlewareRoutesTest extends TestCase
{
<?php
Route::get('/{post}/{comments?}', ...)->benchmark([
'Simple post' => ['post' => Post::first()],
'Complex post' => ['post' => Post::whereComplex()->first()],
'Post with 10 coments' => ['post' => Post::withComments()->first(), 'comments' => 10]
]);
// ==UserScript==
// @name Hide all YouTube Music recommendations
// @description Hide all recommended YouTube Music playlists from YouTube home page
// @version 1.0
// @match https://www.youtube.com
// ==/UserScript==
(function() {
'use strict';
// ==UserScript==
// @name Hide already watched YouTube videos
// @version 0.1
// @description Hide already watched recommended YouTube videos from the home page
// @match https://www.youtube.com
// ==/UserScript==
(function() {
'use strict';
@assertchris
assertchris / ScrollPicker.gd
Last active May 20, 2022 11:26
iOS-like scroll picker container for text selection
extends ScrollContainer
class_name GameScrollPicker
export (Array, String) var items := [] setget set_items
export (Resource) var label_theme
export var label_height := 50
onready var _items := $Items as VBoxContainer
func set_items(items : Array) -> void: