Skip to content

Instantly share code, notes, and snippets.

View dcs619's full-sized avatar

David Stevens dcs619

View GitHub Profile
@dcs619
dcs619 / gist:a95b3ea9ecb517cf07dfb978798a92b6
Created August 15, 2017 16:09
Dynamic Data Date Range
<div class="form-group date-range-picker ">
<label class="control-label" for="date_range_selection">Date Range</label>
<div class="control-wrapper">
<div id="date_range_selection">
<div class="form-control-group">
<div class="input-group input-width-md date input-group-lower input-width-md js-date-picker date">
<input name="date_range_selection_lower" type="text" id="date_range_selection_lower" class="form-control"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
<div class="input-group form-control-static"> to </div>
<div class="input-group input-width-md date input-group-upper input-width-md js-date-picker date">
@dcs619
dcs619 / badge.liquid
Created March 15, 2017 13:57
Background Check Badge
{% assign bgcstate = Person | Attribute:'BackgroundCheckResult' %}
{% assign bgcdate = Person | Attribute: 'BackgroundCheckDate' %}
{% assign today = 'Now' | Date: 'M/dd/yyyy' %}
{% if bgcdate != "" %}
{% assign numdays = bgcdate | DateDiff: today, 'd' %}
{% assign expdate = bgcdate | DateAdd: 1095 %}
{% assign daystil = 1095 | Minus: numdays %}
{% endif %}
{% if daystil <= 30 and numdays < 1095 and bgcstate == 'Pass' -%}
<div class="badge badge-BGC-Status" data-toggle="tooltip" data-original-title="{{ Person.NickName }}'s background check will expire in {{ daystil }} days!">
@dcs619
dcs619 / EntityFramework.psm1
Created February 2, 2017 22:07
Improved EF build times with Rock (replaces Rock\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1)
# Copyright (c) Microsoft Corporation. All rights reserved.
$InitialDatabase = '0'
$knownExceptions = @(
'System.Data.Entity.Migrations.Infrastructure.MigrationsException',
'System.Data.Entity.Migrations.Infrastructure.AutomaticMigrationsDisabledException',
'System.Data.Entity.Migrations.Infrastructure.AutomaticDataLossException',
'System.Data.Entity.Migrations.Infrastructure.MigrationsPendingException',
'System.Data.Entity.Migrations.ProjectTypeNotSupportedException'
@dcs619
dcs619 / console.js
Created February 2, 2017 21:24
JS to select all schedules on a Check-in Schedule page
$('input:checkbox').prop('checked', true);
@dcs619
dcs619 / daterange.html
Created January 26, 2017 16:23
Date Range for Dynamic Data
<div class="form-group date-range-picker ">
<label class="control-label" for="ctl00_main_ctl23_ctl01_ctl06_gfTransactions_drpDates">Date Range</label>
<div id="ctl00_main_ctl23_ctl01_ctl06_gfTransactions_drpDates">
<div class="form-control-group">
<div class="input-group input-width-md date input-group-lower input-width-md js-date-picker date">
<input name="drpDates_lower" type="text" id="drpDates_lower" class="form-control" value="{{ PageParameter.StartDate }}" />
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
</div>
@dcs619
dcs619 / gist:cd0a7682c4a33b06dc3fb9891e7f401e
Last active April 8, 2016 18:12 — forked from dalenewman/gist:6377911
A T-SQL stored procedure for moving an index from one file group to another. The original script was found at http://blogs.msdn.com/b/ramoji/archive/2008/09/26/how-to-move-existing-indexes-from-one-filegroup-to-another.aspx and updated according to responses found on the same page.
/*
-- See below for moving a non-clustered file index. Moving a clustered index is the same
-- as moving the data, as each row lives as a leaf somewhere in the index tree.
-- Current syntax for moving a CLUSTERED file index:
PRINT 'Moving PK_dbo.Group index'
CREATE UNIQUE CLUSTERED INDEX
[PK_dbo.Group]
ON
[Group] ( [Id] )
@dcs619
dcs619 / updatestats.sql
Last active March 9, 2016 17:54
Update table stats
--select '
--PRINT ''Updating ' + [name] + '''
--UPDATE STATISTICS [dbo].[' + [name] + ']
--'
--from sysobjects where type = 'U'
--and name <> '__MigrationHistory'
--order by [name]
PRINT 'Updating _org_sparkdevnetwork_Documentation_Book'
UPDATE STATISTICS [dbo].[_org_sparkdevnetwork_Documentation_Book]
@dcs619
dcs619 / parse.sql
Last active September 28, 2015 16:39
delimited Parse
-- Get a list of Member Id's and their schedules
SELECT EntityId, r.value('.', 'varchar(255)') AS Schedule
FROM (
-- create valid xml path
SELECT EntityId, CAST('<n>' + REPLACE(Value, ',', '</n><n>') + '</n>' AS XML) AS 'Schedules'
FROM AttributeValue
WHERE Id = 1257002
) AS baseXML
-- parse the xml into a table
CROSS APPLY Schedules.nodes('n') AS parse(r)
@dcs619
dcs619 / optional.sql
Created September 21, 2015 20:20
Perform an optional join on NULL parameter
DECLARE @Today datetime = GETDATE()
DECLARE @CampusId int
SELECT @CampusId = 2
DECLARE @CampusGuid uniqueidentifier
SELECT @CampusGuid = '6246DDEF-8AC9-4C25-B011-430CEE590F0F'
SELECT COUNT(DISTINCT PersonAliasId)
FROM Attendance A
INNER JOIN (
@dcs619
dcs619 / lookup.cs
Created January 14, 2015 20:33
IP Address lookup
lblInfo.Text = string.Format( "Device IP: {0} {1} Name: {2}", ipAddress, Environment.NewLine, hostName );
var localaddr = Request.ServerVariables["LOCAL_ADDR"];
lblInfo.Text += "<br> local" + localaddr;
var remoteHost = Request.ServerVariables["REMOTE_HOST"];
lblInfo.Text += "<br> remote" + remoteHost;
var getclient = GetClientIPAddress();
lblInfo.Text += "<br> getclient" + getclient;
var remoteaddr = Request.ServerVariables["REMOTE_ADDR"];
lblInfo.Text += "<br> remote" + remoteaddr;
//(Request.ServerVariables["HTTP_X_FORWARDED_FOR"]) ? Request.ServerVariables["REMOTE_ADDR"]).Split(',')[0].Trim();