Skip to content

Instantly share code, notes, and snippets.

View yeongsheng-tan's full-sized avatar

Tan Yeong Sheng yeongsheng-tan

View GitHub Profile
@coreyhaines
coreyhaines / Flow.elm
Last active December 14, 2020 00:20
General workflow-management
module Flow exposing (Flow(..), map, withDefault, mapDefault, view, update)
import Html
type Flow state
= NotRunning
| Running state
@henrik
henrik / uninstalling_erlang_history.md
Last active March 16, 2017 09:34
Uninstall erlang-history

I wanted to uninstall erlang-history on OS X because of this issue.

This is what I did, essentially reversing the install instructions.

Note that file paths may vary with OS, installation method, versions etc.

  • Open /usr/local/Cellar/erlang/18.3/lib/erlang/lib/kernel-4.2/ebin/kernel.app in an editor and remove group_history from the modules list.
  • Recompile group.erl like so: cd /usr/local/Cellar/erlang/18.3/lib/erlang/lib/kernel-4.2/src; erlc group.erl
  • Move the compiled group.beam from src to ebin: cd ..; mv src/group.beam ebin/
  • Remove group_history.beam just to be tidy: rm ebin/grop_history.beam
@jessejanderson
jessejanderson / intro-to-otp-in-elixir-resources.md
Last active June 15, 2023 05:03
Intro to OTP in Elixir - Resources

Justin Searls presents, "Tenderlove: the DHH story of a boy named Gary Bernhardt"

Short abstract

Ruby has heroes. Demigods who show us how to write better code. Turns out: they're just ordinary developers! This is the story of how I discovered that by becoming Ruby-famous. In the process, I learned our hero culture is toxic.

Want to keep Ruby weird? Stop listening to us (right after my talk).

Full abstract

defmodule Roman do
@numerals %{1 => "I",
5 => "V",
10 => "X",
50 => "L",
100 => "C",
500 => "D",
1000 => "M"}
def numerals(number) do
@CMCDragonkai
CMCDragonkai / building_a_nix_package_c&c++.md
Last active April 8, 2024 16:38
Building a Nix Package (The C&C++ Version)

Building a Nix Package (The C&C++ Version)

Nix can be used to build any kind of package. But here I'm just going to focus on the simple C&C++ case.

Firstly we have to know that the final built packages will located inside /nix/store. Which is globally readable directory of all build inputs and build outputs of the Nix system. The emphasis is on readable, not writable, that is /nix/store is meant to be modified by the user or programs except for the Nix system utilities. This centralises the management of packages, and keeps our packages and package configuration consistent.

So what exactly are we trying to build. Our goal is to build a directory that will be located in /nix/store/*-package-version/, where * is the hash of the package. Preferably a version is also available, but some C&C++ packages don't have versions, so in that case, there's only /nix/store/*-package/.

What will be inside this directory? It follows the GNU Coding Standards descri

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
@robphoenix
robphoenix / spacemacs-cheshe.md
Last active February 6, 2024 23:11
[DEPRECATED] Spacemacs Cheat Sheet - Visit https://github.com/Ben-PH/spacemacs-cheatsheet

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
Transformation Priority Premise
({}–>nil) no code at all->code that employs nil
(nil->constant)
(constant->constant+) a simple constant to a more complex constant
(constant->scalar) replacing a constant with a variable or an argument
(statement->statements) adding more unconditional statements.
(unconditional->if) splitting the execution path
(scalar->array)
(array->container)

Elixir Meetup Notes

Hey, here are the bookmarks from my notes of our Elixir Meetup: