# supports only notice and alert by default
# the rest has to go into flash hash
redirect_to :index, notice: "success"
redirect_to :new, notice: "errors"
redirect_to :new, flash: { success: "yeah" }
flash[:info] = "updated"
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
// NSScanner+Swift.swift | |
// A set of Swift-idiomatic methods for NSScanner | |
// | |
// (c) 2015 Nate Cook, licensed under the MIT license | |
import Foundation | |
extension Scanner { | |
// MARK: Strings |
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
// jQuery-like syntactic sugar. Only queries for one element. Does not loop over multiple like jQuery | |
function $(query) { | |
if (typeof query === 'undefined') throw 'No query provided to $'; | |
var el; | |
if (typeof query.nodeType === 'string') { | |
el = query; | |
} else if (typeof query === 'string' && query[0] === '<') { | |
const container = document.createElement('div'); | |
container.innerHTML = query; |