Skip to content

Instantly share code, notes, and snippets.

View JamesSkemp's full-sized avatar

James Skemp JamesSkemp

View GitHub Profile
@JamesSkemp
JamesSkemp / Search TFS Messages
Created October 14, 2014 15:11
Command line search TFS commit messages
tf history /server:http://server:8080/tfs/xxx "$/path" /recursive /format:detailed > "c:\path\search.txt"
@JamesSkemp
JamesSkemp / Extract All Archives With 7-Zip
Created November 6, 2014 14:58
Extract all zip files with 7-Zip Command Line
7za x *.7z -oExtracted
@JamesSkemp
JamesSkemp / Lenovo A7600-F TAB A10 ADB
Created November 6, 2014 18:33
Lenovo A7600-F TAB A10 ADB interface information
;Lenovo A7600
%SingleAdbInterface% = USB_Install, USB\VID_17EF&PID_7731
%CompositeAdbInterface% = USB_Install, USB\VID_17EF&PID_7731&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_17EF&PID_7731&REV_0216&MI_01
@JamesSkemp
JamesSkemp / Sitecore Workflow State History
Created November 13, 2014 21:35
Sitecore Workflow State History
use xxx_Master
-- Get workflow state names, ids, and counts
/*
select i2.Name, wh.NewState, count(*)
from WorkflowHistory wh
left join Items i2 on wh.NewState = i2.ID
group by i2.Name, wh.NewState
*/
@JamesSkemp
JamesSkemp / DeleteExtraVersions.aspx.cs
Created February 10, 2015 21:43
Delete old item versions in Sitecore
using Sitecore.Data;
using System;
using System.Linq;
namespace JamesRSkemp.Apps.OneOffs
{
public partial class DeleteExtraVersions : System.Web.UI.Page
{
private Database db = Database.GetDatabase("master");
@JamesSkemp
JamesSkemp / ParseColors.java
Created February 20, 2015 03:23
Parse a standard or hex color in Java.
// Thanks to OpenGL ES 2 for Android by Kevin Brothaler
float red = Color.red(Color.GREEN) / 255f;
float green = Color.green(Color.GREEN) / 255f;
float blue = Color.blue(Color.GREEN) / 255f;
int parsedColor = Color.parseColor("#0099CC");
float red = Color.red(parsedColor) / 255f;
float green = Color.green(parsedColor) / 255f;
float blue = Color.blue(parsedColor) / 255f;
@JamesSkemp
JamesSkemp / Git SSH.ps1
Created March 11, 2015 02:03
Setup Git auth on a new Windows machine
# make sure poshgit and git are installed via Chocolatey (via admin)
choco list -l
# update PowerShell profile
notepad $profile
# add these lines at the top (to find ssh-agent)
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"
# reload profile
. $profile
# check Git config
git config --global -l
@JamesSkemp
JamesSkemp / jQuery Headings.js
Created March 18, 2015 19:35
jQuery headings selector
$( ":header" );
// An alternative to the longer:
$('h1, h2, h3, h4, h5, h6');
@JamesSkemp
JamesSkemp / Sitecore Items With the Highest Version Count.sql
Last active August 29, 2015 14:20
Check the Sitecore VersionedFields table for items with the largest number of versions
use xxx_Master
select top 10 ItemId, count(*)
from VersionedFields
-- Field that all items will have.
where FieldId = '5DD74568-4D4B-44C1-B513-0AF5F4CDA34F'
-- exclude any items that you'd like
and ItemId not in ('8C4CCA29-6750-4DCF-A3F9-970CC5896427')
group by ItemId
order by count(*) desc
@JamesSkemp
JamesSkemp / Sitecore-LinksToSublayout_Control.sql
Created May 7, 2015 19:34
Sitecore - basic way to find links to a sublayout/control
use xxx_Core
select top 10 *
from Links
where SourceDatabase = 'master'
-- Item ID of the control that we want to find usage for.
and TargetItemID = '86C15AC5-661B-4288-A997-DCB251CC739E'