Skip to content

Instantly share code, notes, and snippets.

I'm using svelte 5 instead of svelte 4 here is an overview of the changes.

Overview

Svelte 5 introduces runes, a set of advanced primitives for controlling reactivity. The runes replace certain non-runes features and provide more explicit control over state and effects.

$state

  • Purpose: Declare reactive state.
  • Usage:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Resource Schema",
"type": "object",
"description": "Schema for resources that offer various services, including information on accessibility, availability, and more.",
"properties": {
"id": {
"type": "string",
"description": "A unique identifier assigned to each resource for tracking and reference."
},
@scragz
scragz / unicoder.rb
Created April 18, 2012 16:59
Probably a dumb way to fix ugly latin1 garbage
class Unicoder
@@char_map = {
# (mostly cp1252) => utf8
"\x80" => "\u20AC", # EURO SIGN
"\x82" => "\u201A", # SINGLE LOW-9 QUOTATION MARK
"\x83" => "\u0192", # LATIN SMALL LETTER F WITH HOOK
"\x84" => "\u201E", # DOUBLE LOW-9 QUOTATION MARK
"\x85" => "\u2026", # HORIZONTAL ELLIPSIS
"\x86" => "\u2020", # DAGGER
"\x87" => "\u2021", # DOUBLE DAGGER
@scragz
scragz / .railsrc
Created March 31, 2011 22:55 — forked from janlelis/.railsrc
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers
<?php
function my_error_handler($errno, $errstr, $errfile, $errline){
$errno = $errno & error_reporting();
if($errno == 0) return;
if(!defined('E_STRICT')) define('E_STRICT', 2048);
if(!defined('E_RECOVERABLE_ERROR')) define('E_RECOVERABLE_ERROR', 4096);
print "<pre>\n<b>";
switch($errno){
case E_ERROR: print "Error"; break;
plugins/
kitchen-sink-html5-base/
docs/
wordpress/
intro_to_wordpress.html
theme/
customizing_icons.html
[etc.]
kst-extra-bonus-appliances/
docs/
<?php
class KST_Kitchen {
protected static $_appliances;
// Registers a loadable appliance and shortname for it
public function registerAppliance($shortname, $path, $class_name=false) {
if (array_key_exists($shortname, $_appliances)) {
// collision!
} else {
self::$_appliances[$shortname] = [];
<?php
/**
* Retrieve the name of the highest priority template file that exists.
*
* Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
* inherit from a parent theme can just overload one file.
*
* @since 2.7.0
*
* @param array $template_names Array of template files to search for in priority order.
<?php
$validation_error = false;
if (array_key_exists('submit', $_POST)) {
if (
!strlen($_POST['contact_name']) ||
!strlen($_POST['contact_email']) ||
!strlen($_POST['contact_message'])
) {
$validation_error = 'Please complete all required fields.';
} else {
<?php
public function output( $post_object, $is_new_day = 1, $reverse = 1 ) {
if ( !empty( $this->asides ) && $is_new_day ) {
if ( $reverse )
$this->asides = array_reverse($this->asides);
?>
<article id="post-aside-<?php $this->asides[0]->post_date; ?>" class="aside hentry">
<?php
foreach ( $this->asides as $post ) {