Skip to content

Instantly share code, notes, and snippets.

@ziprandom
ziprandom / webdav-vs-rest.md
Created January 13, 2018 01:12 — forked from PVince81/webdav-vs-rest.md
Webdav vs REST
Operation Webdav REST
@ziprandom
ziprandom / mu4e-jump-to-thing.el
Created December 12, 2017 18:30
`M-.` style jumping from mu4e-message-view buffers
;;
;; jump to thing on M-.
;;
(defun mu4e-jump-to-thing (u)
"jump to thing under point (should work with addresses, dates, tags)"
(interactive "P")
(let*
(
(type (string-remove-suffix ":" (first (split-string (thing-at-point 'line)))))
(
@ziprandom
ziprandom / handler.cr
Created November 16, 2017 11:57
proxy handler for kemal
proxy_request = ->(env : HTTP::Server::Context) do
req = env.request
req.path = "some_prefix" + req.path
req.headers.delete("Accept-Encoding")
req.headers.delete("X-Auth-Token")
response = HTTP::Client.new(
"new_host", 443, true
@ziprandom
ziprandom / list_files_on_head.cr
Last active September 18, 2017 23:09
Listing files in a git repo using libgit2 bindings
# coding: utf-8
require "git";
# open repo
repo = Git::Repo.open "./"
# get tree
tree = repo.head.to_commit.to_tree
paths = [] of String
@ziprandom
ziprandom / type_hierarchy_macros.cr
Last active May 3, 2017 13:47
Nesting & Reusing Crystal Macros to Build Up Class Constans Along the Type Hierarchy
require "spec"
macro on_all_child_classes(&block)
macro injection
{{block && block.body}}
end
macro inject
injection
macro inherited
injection
@ziprandom
ziprandom / sendAsHtmlForm.js
Last active September 24, 2016 00:16
Superagent: Send JSON Object Alongside Files by Flatten the JSON Keys to HTML Form Names
import request from 'superagent';
/*
* given files is an array of File Objects:
*
* sendAsHtmlForm("/api/posts",
* "post", {title: "a title", body. "a body"}, files)
*
*/
function sendAsHtmlForm(url, method, json, files) {

Manage your gmail account in emacs with mu4e

There're a lot of combinations to manage your email with emacs, but this works for me. I've a backup and I can manage my daily email.

The stack:

  • emacs
  • offlineimap
  • mu
  • mu4e