This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import Combine | |
| extension Subscribers { | |
| final public class Forever<Upstream: Publisher>: Subscriber, Cancellable, CustomStringConvertible { | |
| public typealias Input = Upstream.Output | |
| public typealias Failure = Upstream.Failure | |
| private var subscription: Subscription? = nil | |
| private let receiveCompletion: (Subscribers.Completion<Failure>) -> Void |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE EXTENSION IF NOT EXISTS "unaccent" | |
| CREATE OR REPLACE FUNCTION slugify("value" TEXT) | |
| RETURNS TEXT AS $$ | |
| -- removes accents (diacritic signs) from a given string -- | |
| WITH "unaccented" AS ( | |
| SELECT unaccent("value") AS "value" | |
| ), | |
| -- lowercases the string | |
| "lowercase" AS ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| which heroku > /dev/null | |
| if [[ "$?" != "0" ]]; then | |
| echo "You need to brew install heroku" | |
| exit 1 | |
| fi | |
| heroku local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # rel/config.exs | |
| # ... | |
| environment :prod do | |
| # ... | |
| plugin(Example.Phoenix) | |
| end | |
| # ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function create (name) { | |
| const nameStart = `${name} start` | |
| window.performance.mark(nameStart) | |
| return { | |
| log: () => { log(name) }, | |
| end: () => { end(name) } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{- $src := .Get "src" }} | |
| {{- $s := newScratch }} | |
| {{- if eq (len (findRE "^/" $src)) 0 }} | |
| {{- $s.Set "res" ($.Page.Resources.GetMatch $src) }} | |
| {{- with ($s.Get "res") }} | |
| {{- $s.Set "src" .Permalink }} | |
| {{- if ne (len (findRE "@2x" .Permalink)) 0 }} | |
| {{- $s.Set "width" (div .Width 2) }} | |
| {{- $s.Set "height" (div .Height 2) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Since es6 exports are statically validated, we have no need to use stringy | |
| // programming to identify which action to run in response to which event | |
| import { render } from 'some-lib' | |
| export function increment ({ state, emit }) { | |
| state.counter += 1 | |
| emit(render) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="embed"> | |
| {{ $file := .Get "src" }} | |
| {{ if fileExists $file }} | |
| {{ if eq (.Get "markdown") "true" }} | |
| {{ $file | readFile | markdownify }} | |
| {{ else }} | |
| {{ if or (eq (.Get "javascript") "true") (eq (.Get "js") "true") }} | |
| <script> | |
| {{ $file | readFile | safeJS }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const document = [ | |
| newBlock([ | |
| newPart('Hello world '), | |
| newPart('**', { type: 'control', controlType: 'bold', styles: ['bold'] }), | |
| newPart('hooray for ', { styles: ['bold', 'italic'] }), | |
| newPart('_', { type: 'control', controlType: 'italic', styles: ['bold', 'italic'] }), | |
| newPart('nested italic', { styles: ['bold', 'italic'] }), | |
| newPart('_', { type: 'control', controlType: 'italic', styles: ['bold', 'italic'] }), | |
| newPart(' text', { styles: ['bold'] }), | |
| newPart('**', { type: 'control', controlType: 'bold', styles: ['bold'] }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule App.Thing do | |
| use GenServer | |
| def init(%{code: code}) do | |
| Process.flag(:trap_exit, true) | |
| handler = self() | |
| {:ok, task} = Task.start_link(fn -> | |
| port = Port.open( | |
| {:spawn_executable, System.find_executable("npm")}, |