Skip to content

Instantly share code, notes, and snippets.

View HarryMcCarney's full-sized avatar

Harry McCarney HarryMcCarney

View GitHub Profile
@HarryMcCarney
HarryMcCarney / gist:9474504
Created March 10, 2014 21:15
Model Release Life Cycle
private void NextStep()
{
switch(PreviousStep())
{
case Status.Pending:
IWorkFlowStep = new CreatePeopleCountHit(Release, TurkSource);
break;
case Status.SentForPeopleCount:
IWorkFlowStep = new FetchPeopleCountHitResult(Release, TurkSource);
break;
from pyramid.httpexceptions import HTTPBadRequest
from scotty import DBSession
from scotty.cms.models import CmsContent
__author__ = 'Harry'
def set_content(params):
if not isinstance(params, list):
raise HTTPBadRequest("Must submit list of keys as root level.")
if exists(select * from sys.columns
where Name = N'seven_day_impressions' and Object_ID = Object_ID(N'pub.article'))
begin
alter table pub.article
drop column seven_day_impressions
end
go
alter table pub.article
add seven_day_impressions int
@HarryMcCarney
HarryMcCarney / gist:8c4ea0025b8386f0c62c
Last active August 29, 2015 14:12
Candidate Search with anonymous and current employer logic
DROP VIEW IF EXISTS public.v_candidate_search;
CREATE VIEW public.v_candidate_search
AS
SELECT
c.id,
cs.name as status,
to_tsvector(cast(c.id AS VARCHAR(34)) || ', ' ||
c.first_name || ' ' || c.last_name || ', ' || x.skills || ', ' || y.countries
|| ', ' || y.cities) AS search_index,
using System.Collections.Generic;
using Newtonsoft.Json;
namespace FCJobs.StorylineSuggest
{
public class ArticleIndex
{
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
@HarryMcCarney
HarryMcCarney / gist:0102172d7e474e2b5d20
Created January 14, 2015 11:18
Inline Widget Placement
// ==UserScript==
// @name PlacementCode
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
function autoPlaceWidget(widget){
var $root = $( '.entry-content,.entry-inner,.entry,#article,.sociable,.post_text,.post-content,.td-post-text-content,#match-report-left,.post-entry,#article_content,.pf-content' );
if(!$root.length){return widget;}
@HarryMcCarney
HarryMcCarney / gist:5fd2ae69fccc82fa7847
Last active August 29, 2015 14:13
Pages Per Session
select t.impression_date as date, isnull(total_avg_pages, 0) avg_pages_per_session,
isnull(wd_avg_pages, 0) wd_avg_pages_per_session,
isnull(dwd_avg_pages, 0) dwd_avg_pages_per_session
from (select top 90 cast(getutcdate()- n as date) impression_date from pub.tally) t
left join (
select avg(cast(y.total_impresions as float)) total_avg_pages,
avg(cast(y.wd_impresions as float)) wd_avg_pages,
avg(cast(y.dwd_impresions as float)) dwd_avg_pages,
y.session_date
from (
@HarryMcCarney
HarryMcCarney / gist:799ba800ee880cbb1efc
Last active August 29, 2015 14:13
auto assign sl proc
if exists ( select *
from sys.objects
where object_id = object_id('pub.auto_assign_storyline')
and type in ( 'p', 'pc' )
)
drop proc pub.auto_assign_storyline
go
create proc pub.auto_assign_storyline
@blog_id int,
@HarryMcCarney
HarryMcCarney / gist:0355486ba0fc561a0ee2
Last active August 29, 2015 14:16
Basic report definition
name: Users
connection: data source=psjlbac9vm.database.windows.net,1433;Initial Catalog=dfg;User Id=thefc;Password=sfdg;Encrypt=true;Trusted_Connection=false;" providerName="System.Data.SqlClient"
sql: select name, email, created from user where created @from and @to
params:
- name:created
type:DateRange
field:created
- name:email
type:filter
field:email