This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using a predefined hash | |
hash = { field1: "foo", field2: "bar" } | |
HashStruct = Struct.new(*hash.keys, keyword_init: true) | |
hash_struct = HashStruct.new(hash) | |
hash_struct.field1 # => "foo" | |
hash_struct.field2 # => "bar" | |
hash_struct.field3 # => ERROR! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="card"> | |
<div class="card-header"> | |
<h3 class="card-title"> | |
<%= notification.to_notification.in_app_subject %> | |
</h3> | |
</div> | |
<div class="card-body"> | |
<%= notification.to_notification.in_app_body %> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "stimulus" | |
import SlimSelect from "slim-select" | |
import "slim-select/dist/slimselect.min.css" | |
import "../style/slimselect-customized.css" | |
export default class extends Controller { | |
connect() { | |
const limit = this.data.get("limit") | |
const placeholder = this.data.get("placeholder") | |
const searchText = this.data.get("no-results") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |