Skip to content

Instantly share code, notes, and snippets.

View stevelacey's full-sized avatar
🚀
Shipping

Steve Lacey stevelacey

🚀
Shipping
View GitHub Profile

Organisation constitution

full legal name or any trading name

PHP South West UK

detail purpose of the account

...

country or formation

UK

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) ->
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,
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
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 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
@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:

@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)
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"detect_slow_plugins": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"._*",
@stevelacey
stevelacey / survey-completion.js
Last active December 24, 2015 09:19
JS automation of survey completion (with weighting)
function blam(sentiment) {
var sentiment = sentiment || null;
$('input:text, textarea').each(function() {
$(this).val('Generic ' + sentiment + '\'ve input!');
});
$('.question:contains("Email") input:text').val('fake@simpleweb.co.uk');
$('.date-picker').val('October 08, 2014');