Just a few interesting pieces of Scala code
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://[SitecoreInstance]/sitecore/admin/showconfig.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_list_comments( array('avatar_size' => 64) ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LOG(fmt, args...) do { fprintf(stdout, "[MyApp] " fmt "\n", ##args); fflush(stdout); } while (0); | |
USAGE: | |
LOG("Hello World"); | |
OUTPUT: | |
[MyApp] Hello World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (QStringList::iterator it = tmpList.begin(); it != tmpList.end(); ++it) | |
{ | |
QString tmpString = *it; | |
LOG("string: %s", tmpString.toStdString().c_str()); | |
} |
NewerOlder