A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord| use AppleScript version "2.4" -- Yosemite (10.10) or later | |
| use scripting additions | |
| (* | |
| Original script: John Gruber (https://daringfireball.net/linked/2023/12/05/an-applescript-for-safari-split-tabs-to-new-window) | |
| Much more elegant version: Leon Cowle (https://github.com/leoncowle) | |
| Even more elegant version: https://stackoverflow.com/questions/54066100/applescript-to-split-safari-tabs-into-new-window/54089865#54089865 | |
| Worth a warning: "moving" tabs with this script doesn't actually move them like | |
| drag-and-drop does. The tabs "moved" by this script will reload in the new window, |
| /******************************** | |
| * GA data | |
| ********************************/ | |
| let data = { | |
| v: 1, | |
| } | |
| /******************************** | |
| * Initializes GA data | |
| * @param {string} tid your tracking id for GA | |
| * @param {object} req the request object from event.request |
| (function (context, trackingId, options) { | |
| const history = context.history; | |
| const doc = document; | |
| const nav = navigator || {}; | |
| const storage = localStorage; | |
| const encode = encodeURIComponent; | |
| const pushState = history.pushState; | |
| const typeException = 'exception'; | |
| const generateId = () => Math.random().toString(36); | |
| const getId = () => { |
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'colorize' | |
| end | |
| class MatcherInterface | |
| def initialize(some_object) | |
| @some_object = some_object |
| //----------------------------------*\ | |
| // TRIGONOMETRY FUNCTIONS | |
| //----------------------------------*/ | |
| // # Trigonometry in CSS | |
| // | |
| // - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf | |
| // - Useful if you don't want to use JS. | |
| // - With CSS Variables. | |
| // - `calc()` can't do power (x ^ y) so I used multiplication instead. |
Tested working on:
| require "./compiler/crystal/**" | |
| while line = gets | |
| compiler = Crystal::Compiler.new | |
| program = Crystal::Program.new | |
| program.target_machine = compiler.target_machine | |
| prelude = program.normalize(Crystal::Require.new("prelude")) |
| # Ignore static version of the site (used to upload error pages to S3 for Heroku errors) | |
| /out |
| # Syntax sugar | |
| class ArrayValidator < EnumValidator | |
| end |