This file contains 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
<img src="img/some-nice-photo.jpg" data-controller="parallax" /> |
This file contains 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
// head tail recursion in SuperCollider | |
( | |
~array = Array.exprand(5, 30, 300).round; | |
f = { | |
|array, acc| | |
if(array.isEmpty, | |
acc, | |
{ | |
var head; |
This file contains 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/models/board.rb | |
class Board < ApplicationRecord | |
has_many :embeds | |
end |
This file contains 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/embed_imports/_form.html.erb --> | |
<%= form_with(model: [board, embed_import]) do |form| %> | |
<%= form.file_field :upload %> | |
<%= form.submit "Upload Links", class: "inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-lime-600 hover:bg-lime-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-lime-500" %> | |
<% end %> |
This file contains 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 { Droppable } from "@shopify/draggable"; | |
import ApplicationController from "./application_controller"; | |
export default class extends ApplicationController { | |
static targets = ["container", "dropzone", "targetDropzone"]; | |
connect() { | |
this.droppable = new Droppable(this.containerTargets, { | |
draggable: ".draggable", | |
dropzone: ".dropzone" |
This file contains 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/channels/reaction_channel.rb | |
class ReactionChannel < ApplicationCable::Channel | |
def subscribed | |
stream_from "reaction:#{current_user.id}" | |
end | |
end | |
# app/jobs/stream_reaction_job.rb | |
class StreamReactionJob < ApplicationJob | |
include CableReady::Broadcaster |
This file contains 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
(defun jr/gist-carbon-region () | |
"Create a gist, upload to carbon and put the gist URL in the kill ring. | |
This function makes it easy to tweet a marked region: Invoke it and | |
the region will be uploaded to Github, the gist ID appended to carbon, | |
and the default browser opened. As a convenience, the created gist URL | |
is also placed in the kill ring. | |
gist mode (https://github.com/defunkt/gist.el) is required." | |
(interactive) |
This file contains 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 FilterReflex < ApplicationReflex | |
include Filterable | |
def filter | |
resource, param = element.dataset.to_h.fetch_values(:resource, :param) | |
value = element.dataset.value || element.value | |
set_filter_for(resource, param, value) | |
end | |
end |
This file contains 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/filters/base_filter.rb | |
class BaseFilter | |
include ActiveModel::Model | |
include ActiveModel::Attributes | |
def initialize(session) | |
@_session = session | |
super(@_session.fetch(:filters, {})[filter_resource_class]) | |
end |
This file contains 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' | |
export default class extends Controller { | |
static targets = ['overlay'] | |
static values = { | |
hidden: Boolean | |
} | |
static classes = ['hidden', 'shown'] | |
toggle () { |