Skip to content

Instantly share code, notes, and snippets.

View strukturedkaos's full-sized avatar

Don Pottinger strukturedkaos

View GitHub Profile
@nickcernis
nickcernis / mailchimp-popup-for-wordpress.md
Last active July 28, 2022 14:49
MailChimp Popup Script that works with WordPress sites

MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.

Including them in this way isn't always possible or easy with WordPress.

The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.

To use it, modify the baseUrl, uuid, and lid attributes with the ones from the original popup script that MailChimp supplies.

Ember Cheatsheet

1. Templates / Handlebars

1.1 The Application Template: (Think layout.html.erb)

<script type="text/x-handlebars">
  <header>..</header>
  {{outlet}} <-- this displays the route specific template (Rails: yield)
  <footer>..</footer>
@dommmel
dommmel / dokku-pg-backup.sh
Last active September 16, 2020 08:03
dokku postgres backup cronjob (using https://github.com/Kloadut/dokku-pg-plugin)
#! /bin/bash
# directory to save backups in, must be rwx by postgres user
BASE_DIR="/var/backups/postgres"
YMD=$(date "+%Y-%m-%d")
DIR="$BASE_DIR/$YMD"
mkdir -p $DIR
cd $DIR
# make database backup
@catsby
catsby / puma.rb
Created October 17, 2013 14:28
Example config/puma.rb file
preload_app!
min_threads = Integer(ENV['MIN_THREADS'] || 0)
max_threads = Integer(ENV['MAX_THREADS'] || 5)
threads min_threads, max_threads
workers Integer(ENV['WORKER_COUNT'] || 3 )
on_worker_boot do
ActiveSupport.on_load(:active_record) do
@sbeam
sbeam / gist:3849340
Created October 7, 2012 19:39
capybara helper for select2-ajax elements
# select2_ajax helper to make capybara work with ajax-enabled Select2 elements
# assumes 'placeholder' option is used in Select2 (if it is using ajax, it should be)
#
# usage:
#
# it "should have a select2 field for searching by team name" do
# @team = Factory :team
# select2_ajax @team.name, :from => "Select a Team", :minlength => 4
# click_button "Join"
# page.should have_content "You are now on '#{@team.name}'."
@jkassemi
jkassemi / gist:3797001
Created September 27, 2012 23:09
Select2.js capybara
def select2_select(text, options)
page.find("#s2id_#{options[:from]} a").click
page.all("ul.select2-results li").each do |e|
if e.text == text
e.click
return
end
end
end