Skip to content

Instantly share code, notes, and snippets.

View jmdfm's full-sized avatar
💭
😺

John McDowall jmdfm

💭
😺
View GitHub Profile
@jmdfm
jmdfm / html-editors.md
Created April 3, 2019 03:14 — forked from manigandham/rich-text-html-editors.md
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

  • ProseMirror - http://prosemirror.net - supports collaborative editing, offers similar options to Mobiledoc for data structure
@jmdfm
jmdfm / gist:290d251195c0334069adda33f08f1d96
Created January 8, 2019 01:17 — forked from digitaljhelms/gist:3099010
Squash the first two commits in a git repository's history

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....
@jmdfm
jmdfm / base.js
Created October 10, 2018 20:01 — forked from tkh44/base.js
emotion with styled-system.
import React from 'react'
import styled from 'emotion/react'
import { omit } from 'emotion/lib/utils'
import { space, width, fontSize, color, responsiveStyle } from 'styled-system'
import { baseCss } from './ui'
const defaultExcludedProps = [
'm',
'mt',
@jmdfm
jmdfm / Readme.md
Created August 19, 2018 20:27 — forked from sshkarupa/Readme.md
Creating a new Rails application project with Docker

You certainly won't need anything installed other than Docker to create Ruby apps...

1: Generating the project

The idea is to mount the current folder into a temporary Ruby container using the official Ruby image from Docker Hub, then install Rails inside this temporary container, and then create the project skeleton using the rails new command.

# Start bash inside a Ruby container:
@jmdfm
jmdfm / loadingspinner.pde
Created May 30, 2018 04:51 — forked from marcedwards/loadingspinner.pde
A loading spinner with 6 dots
// A loading spinner with 6 dots.
// By @marcedwards from @bjango.
//
// Pretty messy and hacked together, but it works. ¯\_(ツ)_/¯
// Created using Processing 3.3.7.
float scaler = 0.24 * 4; // Scale the entire design.
float scalerb = 4; // Scale the entire design more.
int frame = 0;
@jmdfm
jmdfm / .Xresources
Created November 27, 2017 19:02 — forked from cirrusUK/.Xresources
termite emulator orange theme and other stuff
! __ ___ __ ___ ___ ___ _ _ _ __ ___ ___ ___
! \ \/ / '__/ _ \/ __|/ _ \| | | | '__/ __/ _ \/ __|
! _ > <| | | __/\__ \ (_) | |_| | | | (_| __/\__ \
!(_)_/\_\_| \___||___/\___/ \__,_|_| \___\___||___/
!
!## Colors
#define S_base03 #191919
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
@jmdfm
jmdfm / dynamic-critical-path-css.md
Created November 17, 2017 19:58 — forked from taranda/dynamic-critical-path-css.md
Dynamically Add Critical CSS to Your Rails App

Dynamically Add Critical CSS to Your Rails App

Optimizing the delivery of CSS is one way to improve user experience, load speed and SEO of your web app. This involves determining the "critical path CSS" and embeding it into the html of your page. The rest of the CSS for the site is loaded asynchronously so it does not block the rendering of your "above the fold" content. This Gist will show you how to dynamically generate critical path CSS for your Rails app.

In this example we will use the mudbugmedia/critical-path-css gem.

Prerequisites

You will need to set up caching and Active Job in your Rails app. I recommend using a thread-safe background job manager like resque.

@jmdfm
jmdfm / update-adblock-dnsmasq.sh
Created October 31, 2017 20:10 — forked from Ar0xA/update-adblock-dnsmasq.sh
USG DNS adblock/malwareblock
#!/bin/bash
#
#DNS adblock/malware block for USG
#
#Orginal script: https://community.ubnt.com/t5/UniFi-Routing-Switching/Use-USG-to-block-sites-apps-like-ER/td-p/1497045
#
#Howto: SSH into your USG:
#sudo su -
#vi /config/user-data/update-adblock-dnsmasq.sh (add file content)
#ESC :wq
@jmdfm
jmdfm / youtube-dl-download-pluralsight.md
Created July 10, 2017 22:22 — forked from munim/youtube-dl-download-pluralsight.md
youtube-dl to download pluralsight videos

Download Plural Sight videos

Software required:

youtube-dl

After installation and putting the youtube-dl in PATH

youtube-dl \
@jmdfm
jmdfm / mix.exs
Created May 31, 2017 03:09 — forked from jeffweiss/mix.exs
Retrieving application version number in mix.exs from git describe
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: get_version,
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,