Skip to content

Instantly share code, notes, and snippets.

View moonglum's full-sized avatar

Lucas Dohmen moonglum

View GitHub Profile
@moonglum
moonglum / faucet.config.js
Created June 17, 2020 15:29
experimental middleware feature in faucet. To see it work, create a folder `dist` with some files you want to serve.
module.exports = {
manifest: {
webRoot: "./dist"
},
middleware: [
(req, res, next) => {
// an amazing logger middleware. wow.
console.log(`${req.method} ${req.url}`)
next()
}
@moonglum
moonglum / faucet.config.js
Created May 18, 2020 19:36
Example for a faucet configuration that works with faucet-pipeline-js 2.1.2, but doesn't with 2.1.3
"use strict";
module.exports = {
js: [{
source: "./index.js",
target: "./dist/bundle.js"
}]
};
@moonglum
moonglum / SassMeister-input-HTML.html
Created March 31, 2020 10:31
Generated by SassMeister.com.
<div class="foo">Hello</div>
<div class="bar">Hello</div>
@moonglum
moonglum / faucet.config.js
Created December 29, 2018 11:47
Example of using faucet with nunjucks
let path = require("path");
module.exports = {
sass: [{
source: "./src/app.scss",
target: "./dist/app.css"
}],
nunjucks: [{
source: "./src/index.njk",
@moonglum
moonglum / faucet.config.js
Created November 23, 2018 14:55
Bootstrap faucet starter kit
module.exports = {
sass: [{
source: "./index.scss",
target: "./dist/bootstrap.css"
}]
};
@moonglum
moonglum / Dockerfile
Created April 12, 2018 06:19
A user that can't modify `/app` can modify it when it is mounted
FROM ruby:2.4
RUN useradd -m app && \
mkdir /app
WORKDIR /app
USER app
CMD ["bash"]
@moonglum
moonglum / inline_bundler.rb
Created March 28, 2018 05:52
Running this will first check if the gem mote is installed, install it if it isn't and then require the gem and use it
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "mote", "~> 1.3.0"
end
example = Mote.parse("Hello {{name}}", self, [:name])
puts example.call(name: "World")
# frozen_string_literal: true
source "https://rubygems.org"
gem "rspec"
x = [200, 100, 300].reduce(Float::INFINITY) do |smallest, current|
if current < smallest
current
else
smallest
end
end
p x
fn main() {
println!("Hello, world!");
}
fn make_guess(_g: Game, _c: char) -> Game {
unimplemented!()
}
#[derive(Debug, PartialEq, Eq)]
struct Game {