Skip to content

Instantly share code, notes, and snippets.

@oliverdowling
oliverdowling / State.svelte
Created November 11, 2024 00:13
Svelte 5 State Examples
<!--
Inspired by Joy of Code's YouTube video: Different Ways To Share State in Svelte 5
https://www.youtube.com/watch?v=qI31XOrBuY0
-->
<script lang="ts" module>
// This could be `state.svelte.ts`
// A property of JavaScript: Imported values can only be modified by the exporter.
// Conversely, the importing module can only read the value but can't re-assign it.
export const proxied = $state({ value: 0 });
@oliverdowling
oliverdowling / install-jre-macosx-x64.sh
Last active October 18, 2016 03:01
Install Oracle's JRE on Mac OS X
#!/bin/bash
# DISCLAIMER! Although this file *could* be executed, I recommend against running this whole file.
# This is because I have not added any error checking
# If, for example, you did not download the correct JRE file to your Downloads folder, or saved it elsewhere, this will likely move your home directory
# If you have ignored that and just want to run the file anyway (it's faster, after all) you'll need to do this in Terminal:
#cd ~/Downloads/
#chmod +x install-jre-macosx-x64.sh
#sudo ./install-jre-macosx-x64.sh
@oliverdowling
oliverdowling / CEButton.h
Last active October 22, 2017 14:51
A custom UIButton extension that can change title and image insets depending on button state.
//
// CEButton.h
//
// Created by Cemal Eker on 11/12/13. (2013-11-12)
// Modified by Oliver Dowling on 2014-04-28.
//
#import <UIKit/UIKit.h>
@interface CEButton : UIButton