Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kodeFant's full-sized avatar

Lars Lillo Ulvestad kodeFant

View GitHub Profile
@kodeFant
kodeFant / CustomCSSFramework.hs
Created March 29, 2023 10:55
Classless CustomCSSFramework for IHP
module Web.View.CustomCSSFramework (customMissing) where
import IHP.View.CSSFramework -- This is the only import not copied from IHP/View/CSSFramework.hs
import IHP.Prelude
import IHP.FlashMessages.Types
import qualified Text.Blaze.Html5 as Blaze
import Text.Blaze.Html.Renderer.Text (renderHtml)
import IHP.HSX.QQ (hsx)
import IHP.HSX.ToHtml ()
import IHP.View.Types
@kodeFant
kodeFant / block1.elm
Last active February 16, 2021 15:03
block1.elm
type MealPreference = Vegan | Vegetarian | Meat
type CelebrityStatus = NonCelebrity | Celebrity
type alias PassengerInfo = {name: String, passportId: String, extraLuggage: String}
type Passenger
= Economy PassengerInfo
| FirstClass MealPreference PassengerInfo CelebrityStatus

Set up Elm in IHP

Archived content from the IHP with Elm series

This is just archived content from part 1 because IHP integrated this part of the tutorial into a boilerplate in the framework. It could be helpful to reference in case you want to set it up manually in an exisiting project.

Update .gitignore

Let's update .gitignore as soon as possible to avoid pushing unwanted stuff into git.

@kodeFant
kodeFant / configuration.nix
Last active January 11, 2024 14:24
My NixOs configuration with xMonad working
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@kodeFant
kodeFant / remote-data.ts
Last active June 5, 2021 11:36
RemoteData for TypeScript. Read more about how to use this pattern here: https://driftercode.com/blog/slaying-a-ui-antipattern-with-typescript
type RemoteData<E, D> =
| { type: "NOT_ASKED" }
| { type: "LOADING" }
| { type: "FAILURE"; error: E }
| { type: "SUCCESS"; data: D };
function foldRemoteData<R, E, D>(
remoteData: RemoteData<E, D>,
notAsked: () => R,
return foldRemoteData(
() => <FetchPosts getPosts={getPosts} />,
() => <Loading />,
(error: Error) => <Failure error={error} />,
(data: Post[]) => <BlogPosts data={data} />
)(posts);
type RemoteData err data
= NotAsked
| Loading
| Failure err
| Success data
system_type=$(uname -s)
if [ "$system_type" = "Darwin" ]; then
# install homebrew if it's missing
if ! command -v brew >/dev/null 2>&1; then
echo "Installing homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
@kodeFant
kodeFant / laravel-api-controllers.php
Created June 22, 2018 20:38
Boilerplate for Laravel JSON API
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Article;
use App\Http\Resources\Article as ArticleResource;
class ArticleController extends Controller
{
@kodeFant
kodeFant / .01-laravel-react-setup.md
Last active August 12, 2018 11:30
Laravel 5.6 API / React 16 / Visual Studio Code setup