Instantly share code, notes, and snippets.

View format-comic-list-entries.viml
function! InsertHyphensAndUnderscores()
execute "normal! i- wi_f#gea_"
endfunction
function! InsertEmptyLines()
silent g/.\n\n\@!/norm o
endfunction
function! FormatComicListEntries()
execute "normal! gg^VG:sort\<CR>"
View decode.md

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
View JacksonKotlinModuleExample.kt
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
fun main(args: Array<String>) {
// val mapper = ObjectMapper().registerModule(KotlinModule())
// val mapper = ObjectMapper().registerKotlinModule()
val mapper = jacksonObjectMapper()
val writer = mapper.writerWithDefaultPrettyPrinter()
val json1 = writer.writeValueAsString(Data1(1, "Foo", "Bar"))
View gist:4fea9016fee7300211a986d9fb68ee46
ffmpeg -y -t 10 -i tmuxinator-edited-4.mov -vf fps=10,scale=900:-1:flags=lanczos,palettegen palette.png;
ffmpeg -t 10 -i tmuxinator-edited-4.mov -i palette.png -filter_complex "fps=10,scale=900:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
View copy-and-rename.sh
for file in crushed-*; do cp "$file" "${file/crushed-/}"; done
View test-layout.sh
#!/bin/bash
# Clear rbenv variables before starting tmux
unset RBENV_VERSION
unset RBENV_DIR
tmux start-server;
cd .
View test-layout.yml
# /home/peter/.config/tmuxinator/test-layout.yml
name: test-layout
windows:
- email:
panes:
- echo zero
- echo one
- echo two
- echo three
View layout.md
  • manually create your layout
  • run either tmux list-windows outside of your session or run list-windows from inside your session in the (tmux) command prompt
  • the output will contain a substring like: [layout e1ce,158x43,0,0{79x43,0,0,1,78x43,80,0[78x10,80,0,2,78x10,80,11,5,78x10,80,22,3,78x10,80,33,4]}]
  • copy/massage the substring to look like the following and you should be set:
windows:
  - editor:
      layout: e1ce,158x43,0,0{79x43,0,0,1,78x43,80,0[78x10,80,0,2,78x10,80,11,5,78x10,80,22,3,78x10,80,33,4]}
View yield_self_demo.rb
modified_str = "foo"
.yield_self { |str| str.split('') }
.yield_self { |str| str.join('-') }
.yield_self(&:upcase)
.yield_self { |str| "#{str}!" }
puts modified_str # F-O-O!
View default.html
<!doctype html>
<html lang="en">
<head>
<title>$title$ - peterdohertys.website</title>
$if(css)$
<link rel="stylesheet" href="/css/$css$.css" />
$endif$
</head>