Skip to content

Instantly share code, notes, and snippets.

View jmdfm's full-sized avatar
💭
😺

John McDowall jmdfm

💭
😺
View GitHub Profile
@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,
@jmdfm
jmdfm / 0. nginx_setup.sh
Created April 1, 2017 02:15 — forked from mikhailov/0. nginx_setup.sh
Nginx + secure pseudo-streaming
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz

Keybase proof

I hereby claim:

  • I am johnmcdowall on github.
  • I am jmdfm (https://keybase.io/jmdfm) on keybase.
  • I have a public key whose fingerprint is 8D35 46A9 72BB 8467 6353 A9F9 776E EA02 57AF 8B0F

To claim this, I am signing this object:

@jmdfm
jmdfm / Makefile
Created March 6, 2017 01:00 — forked from tj/Makefile
imgix favicons
IMAGE_CDN = https://apex-inc.imgix.net
# Imgix image replacement.
images:
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images