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):
// 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 |
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 { |
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names | |
# *) local and remote tag names |
<?php | |
define('FILES_BASE',dirname(__FILE__) . '/_files'); | |
$message = ''; | |
if(isset($_FILES['menu']['name']) && !empty($_FILES['menu']['name'])){ | |
$basename = safe_name(basename($_FILES['menu']['name'])); | |
$ext = strtolower(substr($basename,strrpos($basename,'.') + 1)); | |
$tmpdir = uniqid( 'file_' ); | |
$file_destination_dir = FILES_BASE . '/' . $tmpdir; | |
$uploadfile = $file_destination_dir . '/' . $basename; |
<?php | |
header('Content-type: text/plain'); | |
error_reporting(E_ALL); | |
ini_set('display_errors', true); | |
$from = 'you@yourdomain.com'; | |
$to = 'you@yourdomain.com'; | |
if(mail($to, 'test message from PHP', phpinfo(), array("From: $from"), "-f$from")){ | |
print('Mail sent successfully'); |