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
const purgecss = require('@fullhuman/postcss-purgecss')({ | |
content: [ | |
'./app/**/*.html.erb', | |
'./app/helpers/**/*.rb', | |
'./app/javascript/**/*.js', | |
], | |
defaultExtractor: content => { | |
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [] | |
const innerMatches = content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || [] | |
return broadMatches.concat(innerMatches) |
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 Jobbable | |
extend ActiveSupport::Concern | |
# This concern allows model instances to run async jobs that depend on them. | |
# Calling #async_method_name will trigger the MethodNameJob | |
PREFIX = "async_" | |
included do | |
def method_missing(method_name) |
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
// DONT FORGET TO `yarn add esbuild-loader` !!! | |
// config/webpacker/environment.js | |
const { environment } = require('@rails/webpacker') | |
const { ESBuildPlugin } = require('esbuild-loader') | |
const esBuildUse = [ | |
{ | |
loader: require.resolve('esbuild-loader'), | |
// What you want to compile to, in this case, ES7 |
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 { 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 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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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
# Put this function to your .bashrc file. | |
# Usage: mv oldfilename | |
# If you call mv without the second parameter it will prompt you to edit the filename on command line. | |
# Original mv is called when it's called with more than one argument. | |
# It's useful when you want to change just a few letters in a long name. | |
# | |
# Also see: | |
# - imv from renameutils | |
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste) |
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)() |
NewerOlder