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
module YieldsMembers | |
module ClassMethods | |
def yields_members_for(*method_names) | |
module_eval do | |
# method_names.each do |method_name| | |
binding.pry | |
define_method :add do |*members, &proc| | |
puts "IN PREPENDED MODULE" | |
binding.pry | |
super members |
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
module YieldsMembers | |
module ClassMethods | |
mattr_accessor :method_names | |
def yields_members_for(*method_names) | |
self.method_names = method_names | |
end | |
end | |
def initialize(...) | |
super(...) |
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 { LitElement, html, css } from "lit"; | |
import { property, customElement } from "lit/decorators.js"; | |
@customElement("content-element-input") | |
class ContentElementInput extends LitElement { | |
@property({ type: Boolean }) | |
contentEditable = true; | |
@property({ type: String }) | |
placeholder = ""; |
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
URI.open(url) do |uri| | |
base_uri = uri.base_uri | |
listable_type = case base_uri.to_s | |
when /soundcloud.com\/(?<artist>.+)\/tracks/ | |
raise UnparsableTrackUrlError | |
when /soundcloud.com\/(?<artist>.+)\/sets\/(?<title>.+)/ | |
SoundCloudPlaylist | |
when /soundcloud.com\/(?<artist>.+)\/(?<title>.+)/ | |
SoundCloudTrack |
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
<!-- app/views/boards/_board.html.erb --> | |
<ul class="..." | |
data-controller="board" | |
data-board-signed-resource-value="<%= board.to_sgid.to_s %>" | |
id="<%= dom_id(board) %>"> | |
<!-- ... --> | |
</ul> |
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
<!-- app/views/boards/_board.html.erb --> | |
<ul class="..." | |
data-controller="board" | |
data-board-signed-resource-value="<%= board.to_sgid.to_s %>" | |
id="<%= dom_id(board) %>"> | |
<!-- ... --> | |
</ul> |
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 { get } from "@rails/request.js"; | |
import { PageSnapshot } from "@hotwired/turbo"; | |
export default class extends Controller { | |
static values = { hoverTime: Number }; | |
connect() { | |
this.element.addEventListener("mouseover", this.prefetch.bind(this)); | |
this.element.addEventListener("touchstart", this.prefetch.bind(this)); | |
} |
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
// useIdle | |
away(event) { | |
consumer.subscriptions.add(this.presenceChannel); | |
} | |
back(event) { | |
this.presenceChannel.unsubscribe(); | |
} |
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
class LocaleReflex < ApplicationReflex | |
def switch | |
@locale = element.value | |
end | |
end | |
class ApplicationController < ActionController::Base | |
around_action :switch_locale | |
def switch_locale(&action) |
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
( | |
Server.killAll; | |
~num_buffers = 4; | |
~num_channels = 12; | |
~rec_end = ~num_buffers.collect { 0 }; | |
~gtranspose = ~num_buffers.collect { 0 }; | |
~density = ~num_buffers.collect { 0.0 }; | |
~stretch = 1.0; |