Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
MichaelCurrin / README.md
Last active March 12, 2023 19:40
Render content for all Jekyll pages as a single JSON endpoint

Make a REST API with Jekyll

Render content for all your Jekyll pages as a single JSON endpoint

How it works

The JSON Liquid file below uses all pages in the site and renders their content.

The output is a map or hash. It uses the page's URL as the key. And the content as plain text (no markdown or HMTL) for the value.

@cmod
cmod / hugofastsearch.md
Last active March 22, 2024 07:02 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@squarism
squarism / multiline.exs
Last active March 25, 2024 15:27
Multiline Anonymous Functions in Elixir
# Examples of Different Styles and Syntax
# legal / positive case / you can do these stuffs
# ---------------------------------------------------------------------------
# single line, nothing special
Enum.map(0...2, fn i -> IO.puts i end)
"""
0
1
@maxivak
maxivak / webpacker_rails.md
Last active April 13, 2023 18:46
Webpack, Yarn, Npm in Rails
@getify
getify / 1.md
Last active October 15, 2020 01:44
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.

    var p = BetterPromise.resolve(42);
    
    var q = Promise.resolve(10);
    
    p.then(console.log).then(q).then(console.log);
@grishgrigoryan
grishgrigoryan / IterableFile.ts
Created May 4, 2018 12:55
Helper to iterate over file in browser using for-await-of loop
interface IConfig{
chunkSize:number
}
class IterableFile implements AsyncIterable<string>{
private reader : FileReader;
private file:File
private config : IConfig = {chunkSize : 64 * 1024}
constructor( file:File,config :Partial<IConfig> = {}){
this.file = file
@jpbecotte
jpbecotte / Vue-cli-3-Phoenix-1.3-HOWTO.md
Last active August 23, 2020 05:32
Vue-cli 3, Phoenix 1.3, a complete how-to

Introduction

I have been struggling to start a new project with Phoenix 1.3 and the new vue-cli 3 for Vue.js. There are tons of example already but none of them suited my needs, because:

  • I want to use the new Vue-cli to select the features that I want,
  • I do NOT want to setup Webpack (I know, what a shame!). The new Vue-cli includes the new vue-cli-service, which uses an instance of webpack-dev-server, so you don't have to import it manually in your project.
  • I do not want to use Brunch.

Create your Phoenix App

Assuming that you have Elixir and Phoenix 1.3 are both installed, let's build our new App.

@joepie91
joepie91 / .md
Last active June 25, 2023 08:51
Useful tools for working with NixOS
@mafintosh
mafintosh / npm-classic-config.sh
Last active June 21, 2018 17:40
Resets the npm defaults to how they used to be
npm config set loglevel http
npm config set progress false
npm config set package-lock false
npm config set save false
mkdir -p ~/.config/configstore/
printf '{"optOut": true,"lastUpdateCheck": 0}' > ~/.config/configstore/update-notifier-npm.json