Skip to content

Instantly share code, notes, and snippets.

View kodeFant's full-sized avatar

Lars Lillo Ulvestad kodeFant

View GitHub Profile
@kodeFant
kodeFant / .eslintrc
Created May 8, 2018 16:00 — forked from elijahmanor/.eslintrc
Add Prettier & ESLint to VS Code with a Create React App
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
@kodeFant
kodeFant / setup-react-app
Last active May 9, 2018 19:23
My Setup React App Checklist
npx create-react-app NewAppName
Get Prettier & ESLint set up
https://gist.github.com/kodeFant/37d80984f275cd1d3122fbf9868b0f7a
Add Reactstrap
https://reactstrap.github.io/
@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
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
type RemoteData err data
= NotAsked
| Loading
| Failure err
| Success data
return foldRemoteData(
() => <FetchPosts getPosts={getPosts} />,
() => <Loading />,
(error: Error) => <Failure error={error} />,
(data: Post[]) => <BlogPosts data={data} />
)(posts);

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 / 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
@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,