A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord| # rubocop disable:all | |
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' |
| recipe :pasta do | |
| add 1.liter, of: :water, in: :pot | |
| turn_on :fire | |
| wait_until :pot, :boiling? | |
| add 1.gram, of: :salt, in: :pot | |
| wait 1.minute | |
| add 150.grams, of: :pasta, in: :pot |
| import * as memoizee from 'memoizee'; | |
| var objIdMap = new WeakMap, objectCount = 0; | |
| function objectId(object: any){ | |
| if (!objIdMap.has(object)) { objIdMap.set(object,++objectCount); } | |
| return objIdMap.get(object); | |
| } |
| <script context="module" lang="ts"> | |
| import type { SvelteComponent } from 'svelte'; | |
| export interface ColumnConfig { | |
| sortable?: boolean; | |
| sort?: string; | |
| name: string; | |
| class?: string; | |
| default?: string; | |
| label: string; |
| import { Parser } from './parser'; | |
| import 'models'; | |
| const parsable = `{ | |
| "data": [ | |
| { | |
| "id": "2", "type": "posts", | |
| "attributes": { "name": "My post", "ciao": null, "description": "ciao", "created_at": "2020-10-10T10:32:00Z" }, | |
| "relationships": { "user": { "data": { "id": "3", "type": "users" } } } | |
| } |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <document> | |
| <steps> | |
| <wait>5</wait> | |
| <press>SkipIntro</press> | |
| <wait>3</wait> | |
| <press>Menu/Settings</press> | |
| <wait>3</wait> | |
| <press>SettingsTab/Options</press> | |
| #!/usr/bin/env bash | |
| tmpfile1=$(mktemp /tmp/report.XXXXXX) | |
| tmpfile2=$(mktemp /tmp/report2.XXXXXX) | |
| cd "$1" | |
| find . >> $tmpfile1 | |
| cd "$2" | |
| find . >> $tmpfile2 |
| # Delete all files in the drive folder, excluding google docs | |
| find . -type f \( ! -iname "*.gdoc" -and ! -iname "*.html" -and ! -iname "*.gsheet" -and ! -iname "*.gdraw" -and ! -iname "*.gslides" -and ! -iname "*.gform" -and ! -iname "*.gtable" -and ! -iname Icon\? \) -delete |
| /* | |
| * An usage example of the previous library | |
| */ | |
| function loadData() { | |
| // Send score 1 | |
| indiexpo.sendScore(1).then(function(data) { | |
| console.log('score sent, response:', data); | |
| }); | |
| // Get current user username |