Skip to content

Instantly share code, notes, and snippets.

View danstn's full-sized avatar
🚀
Binding. Lifting. Zipping.

Daniel Stankevich danstn

🚀
Binding. Lifting. Zipping.
View GitHub Profile
@mdgriffith
mdgriffith / Input.Select.elm
Last active April 23, 2019 11:10
How to manually construct a select menu in Style Elements.
module SelectMenu exposing (..)
import Element exposing (..)
import Element.Input as Input
import Element.Font as Font
import Dom
import Color exposing (..)
@CMCDragonkai
CMCDragonkai / nix_string_and_path_concatenation.md
Last active March 15, 2024 00:21
Nix: String and Path Concatenation #nix #nixos

Nix String and Path Concatenation

From Bas van Dijk:

To understand these things I would recommend using nix-repl:

$ nix-repl
Welcome to Nix version 1.11.2. Type :? for help.
@kleinron
kleinron / morgan-x-forwarded-for.js
Created May 18, 2015 21:31
When using Morgan as the access log writer, in a Vanilla server, use this snippet to respect the x-forwarded-for header as the original client's ip address.
morgan.token('remote-addr', function (req, res) {
var ffHeaderValue = req.headers['x-forwarded-for'];
return ffHeaderValue || req.connection.remoteAddress;
});
@aaronlevin
aaronlevin / reasonable.hs
Last active June 8, 2017 14:55
Reasonably Priced Monads in Haskell
-- | simple/basic Scala -> Haskell translation of Runar's presentation
-- | (https://dl.dropboxusercontent.com/u/4588997/ReasonablyPriced.pdf)
-- | trying to use minimal extensions and magic.
-- | (earlier I had a version using MultiParamTypeClasses for Runar's
-- | Inject class, but scraped it opting for simplicity)
-- | my question: what do we lose by moving towards simplicity?
-- | Future work: use DataKinds, TypeOperators, and potentially TypeFamilies
-- | to maintain and automate the folding of types in Coproduct.
{-# LANGUAGE Rank2Types, DeriveFunctor #-}
@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active April 13, 2021 22:28
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@anthonyringoet
anthonyringoet / template.php
Created April 16, 2012 12:12
aggregate drupal css and js in ONE file each, not one file per group
<?php
function hook_js_alter(&$js){
uasort($js, 'drupal_sort_css_js');
$i = 0;
foreach($js as $name => $script) {
$js[$name]['weight'] = $i++;
$js[$name]['group'] = JS_DEFAULT;
$js[$name]['every_page'] = FALSE;
$js[$name]['scope'] = 'footer';