Skip to content

Instantly share code, notes, and snippets.

View stevelacey's full-sized avatar
🚀
Shipping

Steve Lacey stevelacey

🚀
Shipping
View GitHub Profile
@stevelacey
stevelacey / deploy.rb
Created March 27, 2014 16:10
Capistrano 3 tasks for pushing/pulling a Postgres db
set :user, "my-ssh-user"
set :db, YAML::load(IO.read("config/database.yml")) # assumes rails
namespace :db do
desc "Push database"
task :push do
run_locally do
db = fetch(:db)
env = fetch(:rails_env)
server = fetch(:server)
@stevelacey
stevelacey / keybase.md
Created April 15, 2014 15:20
keybase.md

Keybase proof

I hereby claim:

  • I am stevelacey on github.
  • I am stevelacey (https://keybase.io/stevelacey) on keybase.
  • I have a public key whose fingerprint is 7CBA B7A0 76F9 09FC A43E 4930 35B5 5640 7DCE CA71

To claim this, I am signing this object:

select b.page_uri, x.*, a.body_words as previous_body_words, b.body_words,
(case when a.body_words is null then b.body_words else (b.body_words - a.body_words) end) body_words_diff,
(case when a.article_words is null then b.article_words else (b.article_words - a.article_words) end) article_words_diff,
(case when a.page_or_article_words is null then b.page_or_article_words else (b.page_or_article_words - a.page_or_article_words) end) page_or_article_words_diff,
(case when a.p_words is null then b.p_words else (b.p_words - a.p_words) end) p_words_diff,
(case when a.p_count is null then b.p_count else (b.p_count - a.p_count) end) p_count_diff,
(case when a.img_count is null then b.img_count else (b.img_count - a.img_count) end) img_count_diff
from
(
select
select
max(x.previous_crawl_id) as previous_crawl_id,
x.crawl_id,
max(x.previous_crawl_date) as previous_crawl_date,
x.crawl_date,
sum(a.body_words) as previous_body_words,
sum(b.body_words) as body_words,
(sum(b.body_words) - sum(a.body_words)) as body_words_diff,
sum(a.article_words) as previous_article_words,
sum(b.article_words) as article_words,
select
max(x.previous_crawl_id) as previous_crawl_id,
x.crawl_id,
max(x.previous_crawl_date) as previous_crawl_date,
x.crawl_date,
max(a.body_words_total) as previous_body_words_total,
max(b.body_words_total) as body_words_total,
(max(b.body_words_total) - max(a.body_words_total)) as body_words_diff,
max(a.article_words_total) as previous_article_words_total,
max(b.article_words_total) as article_words_total,
select
x.*,
a.body_words as previous_body_words,
b.body_words as body_words,
(coalesce(b.body_words, 0) - coalesce(a.body_words, 0)) as body_words_diff,
a.article_words as previous_article_words,
b.article_words as article_words,
(coalesce(b.article_words, 0) - coalesce(a.article_words, 0)) as article_words_diff,
obj =
init: ->
@keirsform = $('form.keirform') # could be a wrapper further up, or maybe even the document
# - just something that doesn't get swapped in or out is easiest
@keirsform.on 'click', '.form__item__remove', (e) =>
e.preventDefault()
@removeURL $(e.currentTarget)
removeURL: ($link) ->

Organisation constitution

full legal name or any trading name

PHP South West UK

detail purpose of the account

...

country or formation

UK

@stevelacey
stevelacey / keyhook.js
Last active August 29, 2015 14:16
KeyHook
(function() {
var KeyHook = {
init: function(e) {
if (e.keyCode == 13) {
if (!e.target || !e.target.form) return;
var button;
if (this.isSubmitButton(e.target)) {
button = e.target;
@stevelacey
stevelacey / capistrano-postgres-db-tasks.rb
Last active September 18, 2015 11:06
capistrano postgres db push pull
# config valid only for Capistrano 3.1
lock '3.1.0'
namespace :db do
desc "Push database"
task :push do
run_locally do
app_server = roles(:app).first
db_server = 'db.server.example.com'
user = 'simpleweb'