Skip to content

Instantly share code, notes, and snippets.

@jcdarwin
jcdarwin / .vim
Created May 14, 2016 05:21
Our .vim file
" Use Vundle for plugin management
" https://github.com/VundleVim/Vundle.vim
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@jcdarwin
jcdarwin / .extra
Last active May 14, 2016 06:05
Our .extra file, used with mathiasbynens dotfiles: https://github.com/mathiasbynens/dotfiles
#####################################################
# Paths
#####################################################
# Add paths for epub_tools
export PATH=$PATH:/scripts/epub_tools:/scripts/epub_tools/epub_tools:/scripts/epub_tools/epubcheck:/scripts/epub_tools/epubify:/scripts/epub_tools/epubify_toc:/scripts/epub_tools/epubinfo:/scripts/epub_tools/generate_ncx:/scripts/epub_tools/kindlegen.mac:/scripts/epub_tools/kindlestrip:/scripts/epub_tools/manifester:/scripts/epub_tools/mobi_unpack:/scripts/epub_tools/mobify:/scripts/epub_tools/mobify_toc:/scripts/epub_tools/sequence_ncx
# Add paths for PHP ind PEAR in AMPPs
export PATH=/Applications/AMPPS/php/lib/pear:$PATH
export PATH=/Applications/AMPPS/php/bin:$PATH
@jcdarwin
jcdarwin / Vagrantfile
Created February 28, 2016 08:59
Vagrant file for installing Dokku on an EC2 instance
Vagrant::configure('2') do |config|
config.vm.define :dokku, autostart: false do |box|
box.vm.box = 'trusty'
box.vm.box_url = 'https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box'
box.vm.hostname = 'dokku.me'
box.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
aws.keypair_name = 'aws'
@jcdarwin
jcdarwin / New Mac README.md
Last active December 11, 2015 07:01
A README.md file describing how we set up our environment on a new Mac.

What is this?

This is a description of how we've setup our home directory on this machine.

Dotfiles

We use Mathias Bynen's dotfiles to give us a number of default settings.

@jcdarwin
jcdarwin / microsoft word find and replace
Last active August 29, 2015 14:24
Find and replace in Microsoft Word, using wildcards (Word's form of regular expressions), to join lines with a lowercase character either side of the line break
Find and replace in Microsoft Word, using wildcards (Word's form of regular expressions), to find something like:
going
home
to
going home
In the Find box:
@jcdarwin
jcdarwin / analytics.listener.bookmarklet
Last active August 29, 2015 14:21
Bookmarklet to listen for 'analytics' events and report them to the console
// Bookmarklet to listen for 'analytics' events and report them to the console.
// Created with http://chriszarate.github.io/bookmarkleter/
<a href="javascript:void%20function(){jQuery%26%26jQuery(document).bind(%22analytics%22,function(n){console.log('I%20just%20saw%20an%20%22analytics%20event:%20%22',n)})}();">Drag this link to your browser bookmarks bar</a>
@jcdarwin
jcdarwin / inline_svg_image
Created March 22, 2015 22:26
A function to create SVG data urls for Ruby SASS
# The following goes in your config.rb
module Sass::Script::Functions
def inline_svg_image(path)
real_path = File.join(Compass.configuration.images_path, path.value)
svg = data(real_path)
encoded_svg = CGI::escape(svg).gsub('+', '%20')
data_url = "url('data:image/svg+xml;charset=utf-8," + encoded_svg + "')"
Sass::Script::String.new(data_url)
end
@jcdarwin
jcdarwin / monit-and-gmail
Last active August 15, 2024 08:08
How to allow monit to use gmail as a smtp relay to send out alert emails
# visit https://accounts.google.com/DisplayUnlockCaptcha and click to allow access
# edit /etc/monit/monitrc to include the following
set mailserver smtp.gmail.com port 587
username "whoever@gmail.com" password "whatever"
using tlsv1
with timeout 30 seconds
# run the following to validate access
@jcdarwin
jcdarwin / zindex-highest
Last active November 30, 2016 11:08
Ensure that a given element always has the highest z-index
(function(){
// To see the elements with the highest z-index on a page
var highestZindex = 0;
var forEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]);
}
};
@jcdarwin
jcdarwin / zindex_all
Last active November 30, 2016 11:09
View the z-index of elements on a page
// To see all elements and their z-index on a page
(function(){
// To see all elements and their z-index on a page
var forEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]);
}
};
forEach(document.querySelectorAll('*'), function (index, element) {