Skip to content

Instantly share code, notes, and snippets.

View Herteby's full-sized avatar

Simon Herteby Herteby

View GitHub Profile
@Herteby
Herteby / gist:760c27d2fc9f068f3f669c832daaf275
Last active December 11, 2023 18:23
ChatGPT DALL-E 3 image generation example
We couldn’t find that file to show.
module Api exposing
( Data
, Error(..)
, ErrorResponse
, Origin
, delete
, deleteTask
, errorToNotification
, errorView
, get
module UI.VirtualList exposing (Model, init, view)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (on)
import Html.Keyed as Keyed
import Json.Decode as Decode
type alias Model =
module ID exposing (ID(..), decodeFromString, decoder, encode, encodeAsString, fromInt, toInt, toString)
import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode exposing (Value)
{-| This type ensures you get a type error if you for example accidentally pass a UserId in place of a CompanyId
-}
type ID phantom
= ID Int
module TypedDict exposing (Interface, TypedDict(..), derive)
import Dict exposing (Dict)
type TypedDict comparable k a
= TypedDict (Dict comparable a)
type alias Interface comparable k a b =
<template>
<div class="greeting">
{{greeting}}
</div>
</template>
<script>
module.exports = {
data(){
return {
function fixCircularRefs(object) {
let objectValues = []
let cleanObjectJSON = JSON.stringify(object, removeCircularReferences)
return JSON.parse(cleanObjectJSON)
function removeCircularReferences (key, value) {
if (typeof value === 'object') {
if (objectValues.indexOf(value) !== -1) {
return 'Circular reference to object with key: ' + key
} else {
@Herteby
Herteby / fontawesome.js
Created February 6, 2018 22:41
FontAwesome 5 webfonts
import '@fortawesome/fontawesome-pro-webfonts/css/fontawesome.css'
import '@fortawesome/fontawesome-pro-webfonts/css/fa-light.css'
@Herteby
Herteby / getGlobals.js
Created December 15, 2017 15:01
See all global variables that a site has added
function getGlobals(){
const result = {...window}
const standard = window.open()
Object.keys(standard).forEach(key => delete result[key])
standard.close()
return result
}
getGlobals()
@Herteby
Herteby / .nanorc
Created November 20, 2017 12:01
Modern keybindings etc. for nano
set morespace
set multibuffer
#set nohelp # perhaps comment out until comfortable
set quickblank
set regexp
set smooth
set suspend
set tabsize 2
unbind ^K main