Add the following line to your ApplicationController
:
around_action AssetPreloadingBag::Filter
And when you want to prerender something, you can simply call:
function textNodesUnder(el){ | |
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false); | |
while(n=walk.nextNode()) a.push(n); | |
return a; | |
} | |
for (let node of textNodesUnder(document.documentElement)) { | |
node.nodeValue = node.nodeValue.replace(/[^\s]/g, '█'); | |
} |
type IndexableKeys<T> = { [key in keyof T]: T[key] extends string ? key : never }[keyof T]; | |
function matcher<T>(): <K extends IndexableKeys<T>>(key: K) => <R>( | |
legs: { | |
[key in Extract<T[Extract<K, keyof T>], string>]: (arg: T & Record<K, key>) => R | |
} | |
) => (t: T) => R { | |
return (key) => (legs) => (t) => { | |
const state = t[key]; | |
return legs[state](t); |
const puppeteer = require("puppeteer"); | |
const { default: fetch } = require("node-fetch"); | |
const path = require("path"); | |
const fs = require("fs"); | |
const FILES = path.join(__dirname, "shvetz"); | |
async function main() { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); |
function* enumerate(xs) { | |
let i = 0; | |
for (const x of xs) { | |
yield [i++, x]; | |
} | |
} | |
function mregex(modifiers) { | |
return (strings, ...args) => { | |
let result = ""; |
function SetUUID() { | |
var spreadsheet = SpreadsheetApp.getActive(); | |
const range = spreadsheet.getActiveRange() | |
range.setValues(range.getValues().map(v => v.map(() => Utilities.getUuid()))); | |
}; |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
use std::collections::HashMap; | |
trait Renderable: core::fmt::Debug { | |
fn render(&self) -> String; | |
} | |
impl<A: Renderable, B: Renderable> Renderable for (A, B) { | |
fn render(&self) -> String { | |
format!("{}{}", self.0.render(), self.1.render()) |
#!/bin/bash | |
echo ' | |
activate application "Reminders" | |
tell application "System Events" to keystroke "n" using command down | |
tell application "System Events" to keystroke "'"$*"'" | |
tell application "System Events" to keystroke return | |
' | osascript - |
import * as te from 'fp-ts/lib/TaskEither'; | |
import * as arr from 'fp-ts/lib/Array'; | |
import { pipe } from 'fp-ts/lib/pipeable'; | |
type TaskEither<A, B> = te.TaskEither<A, B>; | |
type TERight<T> = T extends TaskEither<any, infer R> ? R : never; | |
/** | |
* Transforms an object of `TaskEither`s into a TaskEither of the resolved objects. |