Skip to content

Instantly share code, notes, and snippets.

View jasonicarter's full-sized avatar
🏠
Working from home

Jason jasonicarter

🏠
Working from home
View GitHub Profile
@jasonicarter
jasonicarter / gist:6203057
Last active December 20, 2015 22:09
HTML5 Skeleton Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Hello World Title</title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="style.css">
@jasonicarter
jasonicarter / gist:6414255
Last active December 22, 2015 03:59
Qt (for BlackBerry 10) - loop through a QStringList with iterator
for (QStringList::iterator it = tmpList.begin(); it != tmpList.end(); ++it)
{
QString tmpString = *it;
LOG("string: %s", tmpString.toStdString().c_str());
}
@jasonicarter
jasonicarter / gist:6414289
Created September 2, 2013 15:45
BlackBerry 10 logging feature - used to easily log output from classes (native logging in cascades isn't the greatest/easiest to use)
#define LOG(fmt, args...) do { fprintf(stdout, "[MyApp] " fmt "\n", ##args); fflush(stdout); } while (0);
USAGE:
LOG("Hello World");
OUTPUT:
[MyApp] Hello World
@jasonicarter
jasonicarter / SQL Delete duplicate records
Last active December 31, 2015 20:59
Delete duplicate records from table ( sql server )
--columnField1 is the field you're looking for duplicates in
--columnField2 orderby, optional, for example a datetime stamp and you want to keep the latest record
WITH AllRecords_CTE
AS
(
SELECT columnField1,
ROW_NUMBER() over (PARTITION BY columnField1 ORDER BY columnField2 DESC) AS [rn]
FROM #AllRecords
)
DELETE AllRecords_CTE
@jasonicarter
jasonicarter / SQL Merge multiple rows into one
Last active January 3, 2016 12:19
Merge multiple rows into 1 row with column being concatenated into comma separated string. SQL
select column1,
stuff((SELECT distinct ', ' + cast(column2 as varchar(10))
FROM table t2
where t2.column1 = t1.column1
FOR XML PATH('')),1,1,'')
from table t1
group by column1
/*
column1 - field you want to group items based on
@jasonicarter
jasonicarter / Sitecore placeholder
Last active July 18, 2019 13:11
Determine if your ASP.NET Sitecore placeholder has any controls in it
<div class="main">
<sc:Placeholder id="myPlaceHolderID" key="myPlaceHolderKey"></sc:Placeholder>
</div>
//Problem: How do I know if my placeholder is empty?
//#1
var controlCnt = Sitecore.Context.Page.Renderings.Count(
r => r.Placeholder.IndexOf("myPlaceHolderKey", StringComparison.OrdinalIgnoreCase
@jasonicarter
jasonicarter / WordPress Gravator Size Change
Last active August 29, 2015 14:07
Change the size of your WordPress comments Gravatar image
<?php
wp_list_comments( array('avatar_size' => 64) );
?>
@jasonicarter
jasonicarter / Sitecore Insert Option
Last active August 29, 2015 14:07
Remove Insert Option item from the available list if selected item already has children of the specific item
Rules -> Insert Options -> Rules and create a new rule for "item xyz"
Then follow along with the code below to set up the rule
'where' the item is the 'home' item or one of its subitems
'and' 'except where' the item template is 'item xyz'
'and' 'except where' the result of query './*[(@@templateid='{item-xyz-template-ID}')]' exists
add 'item xyz' insert option
Basically: No parent should have more than one item with template id of "item xyz" as a child,
so if it already does, remove "item xyz" as an option in Insert Options list
@jasonicarter
jasonicarter / Sitecore Web.config URL
Created October 21, 2014 19:53
Sitecore web.config URL, including of all of those included config file patches
http://[SitecoreInstance]/sitecore/admin/showconfig.aspx
@jasonicarter
jasonicarter / README.md
Last active November 1, 2022 15:43
Mapping of Toronto Neighbourhoods with TopoJSON and D3.js

Mapping of Toronto Neighbourhoods with TopoJSON and D3.js

  • View on Bl.ocks.org
  • TopoJSON, GeoJSON and Shp files of Toronto neighbourhoods can be found in my repo jasonicarter