Skip to content

Instantly share code, notes, and snippets.

import mediaFilesJSON from "../../static/mediaFiles.json";
export const AssetHelper = {
use(what) {
const match = mediaFilesJSON.find(({ name }) => name === what);
if (!match) throw new Error(`No asset found with name '${what}'`);
require(`../../static/${match.path}`);
@eh-dub
eh-dub / index.d.ts
Last active June 10, 2021 16:45
Sapper + Svelte + Typescript
// in $PROJECT_ROOT/typings/@sapper
declare module '@sapper/app' {
// from sapper/runtime/src/app/types.ts
// sapper doesn't export its types yet
interface Redirect {
statusCode: number
location: string
}
// end
@castwide
castwide / rails.rb
Last active April 27, 2024 08:54
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@Epigene
Epigene / Dokku v0.5.6 Rails App.md
Last active January 5, 2024 14:48
Knowledge-Base for getting a Rails5 app with Cable running on dokku v0.5.6

Dokku v0.5.6 Rails workflow

Straight to Maintenance

0. Set up Droplet

Initialize the droplet with dokku app pre-setup