I hereby claim:
- I am terkwood on github.
- I am terkwood (https://keybase.io/terkwood) on keybase.
- I have a public key ASCBCEmPEZhERf6TRBFM_Ed-SX-sLAVcOEHquPb0nT0Mvgo
To claim this, I am signing this object:
/// https://stackoverflow.com/a/50396438 | |
/// https://stackoverflow.com/questions/47193584/is-there-an-owned-version-of-stringchars | |
use std::io::{BufRead, BufReader, Read}; | |
use std::vec::IntoIter; | |
struct Chunks { | |
remaining: IntoIter<char>, | |
} |
I hereby claim:
To claim this, I am signing this object:
<!-- templates/hooks/after-note.tpl --> | |
<ema:metadata> | |
<span class="mr-2 text-right text-gray-600"> | |
<value var="date" /> | |
</span> | |
</ema:metadata> | |
# Controller option 1, implicit render selected based on format | |
defmodule MyApp.UserController do | |
use Phoenix.Controller | |
def show(conn, %{"id" => id}) do | |
render conn, :show, user: Repo.get(User, id) | |
end | |
end | |
# Controller option 2, explicit render with format pattern match |
Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.
The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows
the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir
and you are good to go.
Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to
a specific version, you will need to compile it yourself. Then asdf
is your best friend.
object Lambda extends App { | |
sealed trait Term | |
sealed trait Var[I <: Index] extends Term | |
sealed trait App[T1 <: Term, T2 <: Term] extends Term | |
sealed trait Abs[T1 <: Term] extends Term | |
sealed trait If[T1 <: Term, T2 <: Term, T3 <: Term] extends Term | |
sealed trait Bool[T1 <: Boolean] extends Term | |
sealed trait Index |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore
is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules
directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file. Create a file called .gitignore
in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.
git config --global core.excludesfile ~/.gitignore
git config --global core.excludesfile %USERPROFILE%\.gitignore
#Inject javascript into HTML pages from console
An easy way to inject Javascripts into the current loaded dom using the developer console in chrome.
jQuery
var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-1.7.2.min.js';
#lang racket | |
(require parser-tools/lex | |
(prefix-in re- parser-tools/lex-sre) | |
parser-tools/yacc) | |
(provide (all-defined-out)) | |
(define-tokens a (NUM VAR)) | |
(define-empty-tokens b (+ - EOF LET IN)) | |
(define-lex-trans number | |
(syntax-rules () |
I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.
There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.
As an example, currently we can express this type: