Skip to content

Instantly share code, notes, and snippets.

FROM alpine
RUN apk add bash \
bsd-compat-headers \
build-base \
linux-headers \
ncurses-dev \
readline-dev \
sqlite-dev \
zlib-dev \
@fiveNinePlusR
fiveNinePlusR / Rails Controller.md
Created March 11, 2024 00:59 — forked from stevenyap/Rails Controller.md
Rails controller cheatsheet

Flash

# 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"
@fiveNinePlusR
fiveNinePlusR / jSugar.js
Created May 19, 2022 18:42 — forked from pseudosavant/jSugar.js
Utility function that adds in some jQuery-like syntactic sugar
// 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;
@fiveNinePlusR
fiveNinePlusR / NSScanner+Swift.swift
Last active December 3, 2018 21:56 — forked from natecook1000/NSScanner+Swift.swift
Swift-friendly NSScanner methods updated for swift 4.2
// 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