Skip to content

Instantly share code, notes, and snippets.

View johnpaulashenfelter's full-sized avatar

John Paul Ashenfelter johnpaulashenfelter

View GitHub Profile
@JoelQ
JoelQ / README.md
Created October 15, 2015 13:50
Using Shell Scripts for a Better User Experience (source for https://robots.thoughtbot.com/improving-user-experience-with-shell-scripts)

Server scripts

This is the source for the scripts discussed in https://robots.thoughtbot.com/improving-user-experience-with-shell-scripts

Both scripts are in the bin/ directory of the repo that contains all the markdown documents for blog posts. Users run bin/server and everything is automatically set up for them to view a local preview of the blog. bin/server-setup is a dependency of bin/server and is never run directly by users.

Maitre-d is the name of the "blog engine" discussed in the article.

@arnov
arnov / ab.py
Last active May 13, 2019 14:29
Bayesian AB Test
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math
def calc_ab(alpha_a, beta_a, alpha_b, beta_b):
'''
See http://www.evanmiller.org/bayesian-ab-testing.html
αA is one plus the number of successes for A

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@jberkus
jberkus / gist:6bbffae5ce10fb399d29
Last active January 13, 2018 06:55
Duplicate Index Query #2: Partial matches
-- check for containment
-- i.e. index A contains index B
-- and both share the same first column
-- but they are NOT identical
WITH index_cols_ord as (
SELECT attrelid, attnum, attname
FROM pg_attribute
JOIN pg_index ON indexrelid = attrelid
WHERE indkey[0] > 0
@jberkus
jberkus / gist:e4cadd6b8877c3bc59c8
Created September 19, 2014 00:36
Duplicate Index Query #1: Exact Duplicates
-- check for exact matches
WITH index_cols_ord as (
SELECT attrelid, attnum, attname
FROM pg_attribute
JOIN pg_index ON indexrelid = attrelid
WHERE indkey[0] > 0
ORDER BY attrelid, attnum
),
index_col_list AS (
SELECT attrelid,
@thomasklemm
thomasklemm / gist:0422fd71a96cfb4cb72a
Last active August 29, 2015 14:01 — forked from trcarden/gist:3295935
SSL on localhost, reusuable across multiple Rails apps
# SSL self signed localhost for rails start to finish, no red warnings.
# 0) Unless present, create `~/.ssl/`
$ mkdir ~/.ssl
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out ~/.ssl/localhost.orig.key 2048
@stucchio
stucchio / bayesian_ab_test_empiritcs.py
Last active January 26, 2021 00:54
bayesian a/b test empirics
from pylab import *
from scipy.stats import beta, norm, uniform
from random import random
from numpy import *
import numpy as np
import os
# Input data
prior_params = [ (1, 1), (1,1) ]
@stucchio
stucchio / bayesian_ab_test.py
Last active April 2, 2023 03:17
Bayesian A/B test code
from matplotlib import use
from pylab import *
from scipy.stats import beta, norm, uniform
from random import random
from numpy import *
import numpy as np
import os
# Input data
@khopkins218
khopkins218 / schedule_spec.rb
Created February 3, 2014 16:23
Schedule Checker for valid rake tasks. Takes the schedule.rb file from and extracts the defined rake tasks to check for validity (spelling, actual task, etc)
require 'spec_helper'
describe "schedule" do
describe "file" do
it "should be present and named correctly" do
expect {
File.exists?("#{Rails.root}/config/schedule.rb")
}.to be_true
end
end