That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:
Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):
| var Marquee = Class.create({ | |
| initialize: function(element) { | |
| this.element = $(element); | |
| this.paused = false; | |
| // If everything fits don't bother with all this mess | |
| if(this.element.scrollWidth == this.element.clientWidth) return; | |
| // Defaults to scrolling through all content in 40 seconds. |
| // requires Prototype.js, as do many great things | |
| /** | |
| * ActiveSupport for JavaScript library, version '0.1' | |
| * (c) 2007 Nicolas Sanguinetti | |
| * | |
| * ActiveSupport for JavaScript is freely distributable under the terms of an | |
| * MIT-style license. For details, see our web site: | |
| * http://code.google.com/p/active-support-for-javascript/ | |
| * |
| class Post < ApplicaationRecord | |
| attribute :warnings, array: true, default: Set.new | |
| def has_warnings? | |
| publishing_checklist.any? | |
| end | |
| private | |
| def publishing_checklist |
That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:
Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):
For example, the list of options is "Foo", "Bar", and "Baz". At the bottom of the list (always at the bottom) the user sees "Add..." as a new option. When she selects that option, the <select> disappears, replaced in place with a focused <input type="text"> ready to accept a new option. It's important to note that this pattern is only usable in cases where the input is stored as a string, and you want to enforce a limited but extensible vocabulary of options. A possible example of this is colors, where you don't want to just let people enter anything, otherwise you would end up with "Gray" and "Grey" and possibly "grey".
app/javascripts/controllers/combo_controller.js
import { Controller } from "stimulus";
export default class extends Controller {
static targets = ['picker'];| # rails new shrtn | |
| # cd shrtn | |
| # rails g model Site url:uniq slug:index | |
| # rake db:migrate | |
| # site.rb | |
| class Site < ApplicationRecord | |
| after_create :generate_slug | |
| delegate :url_helpers, to: 'Rails.application.routes' |
| # == Schema Information | |
| # | |
| # Table name: videos | |
| # | |
| # id :bigint not null, primary key | |
| # created_at :datetime not null | |
| # updated_at :datetime not null | |
| # title :text | |
| # youtube_id :string | |
| # leader_id :bigint |
| <?php | |
| // only run this if the form has been submitted | |
| if(isset($_POST['files'])){ | |
| // where are the PDFs stored on your server? | |
| $source_directory = '/data/www/scripty/pdfs/'; | |
| $files = array(); | |
| // loop over the chosen PDFs | |
| foreach($_POST['files'] as $key => $val){ | |
| // protect against malicious forms -- strip off anything besides a filename | |
| $safe_val = array_pop(preg_split('/\//', $val, -1, PREG_SPLIT_NO_EMPTY)); |
| # routes.rb | |
| match 'ads/:id/present/*path.:format', :to => 'ads#present' | |
| # ads_controller.rb | |
| def present | |
| @ad = Ad.find(params[:id]) | |
| path = "#{params[:path]}.#{params[:format]}" | |
| send_data(@ad.get_file(path), :filename => path, :disposition => 'inline') | |
| end |
| trix-toolbar .trix-dialog--heading { | |
| max-width: 190px; | |
| } | |
| .trix-content h1, .trix-content h2, .trix-content h3, .trix-content h4, .trix-content h5, .trix-content h6 { | |
| line-height: 1.2; | |
| margin: 0; | |
| } | |
| .trix-content h1 { |