One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
I had a few issues getting the Crystal compiler to run on MacOS Sierra, these are the seteps I took to get it up and running.
Firstly install the Crystal Language through Homebrew;
brew install crystal-lang
| const features = [ | |
| 'Map', | |
| 'Set', | |
| 'requestAnimationFrame' | |
| ] | |
| function browserSupportsAllFeatures() { | |
| return features.every(f => window[f]) | |
| } |
Create the app and download the necessary dependencies.
| # Preloading usually required an extra query. | |
| # To do it in one query, a `join` is needed, and the call to `preload` needs to know the name of join | |
| # This macro does both the `join` and `preload` together | |
| defmodule Preloader do | |
| import Ecto, only: [assoc: 2] | |
| alias Ecto.Query.Builder.{Join, Preload} | |
| defmacro preload_join(query, association) do | |
| expr = quote do: assoc(l, unquote(association)) | |
| binding = quote do: [l] |
| defmodule MyApp.Telemetry do | |
| require Logger | |
| def handle_event([:my_app, :repo, :query], measurements, metadata, _config) do | |
| milliseconds = System.convert_time_unit(measurements.total_time, :native, :millisecond) | |
| # did the query take longer than 100ms? | |
| if milliseconds > 100 do | |
| # log it as a warning | |
| Logger.warn("SLOW QUERY: ms: #{milliseconds}, query: #{metadata.query}") |
| import { useLoaderData } from "@remix-run/react"; | |
| import { useEffect } from "react"; | |
| export const useStrictLoaderData = () => { | |
| const data = useLoaderData(); | |
| const accessed = [] as String[]; | |
| const getAllKeys = (obj: any, path = "") => { | |
| const keys = [] as String[]; |