Skip to content

Instantly share code, notes, and snippets.

View Herteby's full-sized avatar

Simon Herteby Herteby

View GitHub Profile
@Herteby
Herteby / .bashrc
Last active March 23, 2018 12:40
Convenient .bashrc settings
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\u\[\033[01;34m\] \w \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\u\[\033[01;34m\] \w \$\[\033[00m\] '
fi
shopt -s cdspell
shopt -s nocaseglob
alias ls='ls -ohFGA'
<template>
<div class="virtual-table" :class="{clickableRows:!!($listeners && $listeners.click)}">
<div class="tableHead" ref="head">
<template v-if="search">
<icon fa="search"></icon><input class="search" v-model="searchString" placeholder="Search" ref="search" autofocus>
</template>
<label v-for="filter in savedFilters" class="filter" ><checkbox v-model="filter.enabled">{{filter.display | tra}}</checkbox></label>
<div class="count">Results: {{typeof fullCount == 'number' ? fullCount.toLocaleString() : fullCount}}</div>
<div class="fields" ref="fields">
<div
@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
@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 / 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'
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 {
<template>
<div class="greeting">
{{greeting}}
</div>
</template>
<script>
module.exports = {
data(){
return {
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 =
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 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 =