Skip to content

Instantly share code, notes, and snippets.

View JamesSkemp's full-sized avatar

James Skemp JamesSkemp

View GitHub Profile
@JamesSkemp
JamesSkemp / NCSU Web Evaluation Tools Bookmarklet console-ified.js
Created August 27, 2015 15:31
NCSU Web Evaluation Tools Bookmarklet console-ified
// A browser console-ready conversion of NCSU's bookmarlet. See http://accessibility.oit.ncsu.edu/tools/web-evaluation-tools/
var yourURL=(window.location.protocol=='http:'?'http://webapps.ncsu.edu/web-evaluation-tools/web-evaluation-tools.php':'https://webapps.ncsu.edu/web-evaluation-tools/web-evaluation-tools.php');
function getScript(url,success){
var script=document.createElement('script');script.src=url;
var head=document.getElementsByTagName('head')[0],done=false;
script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){
done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script);
}
};
head.appendChild(script);
@JamesSkemp
JamesSkemp / modDevelopment.bas
Created February 17, 2014 16:58
Module for Microsoft Visual Basic for Applications (specifically Access) that provides various developer functions.
Option Compare Database
Option Explicit
' Dumps connection data for all ODBC/linked tables.
Function DumpConnectionData() As Boolean
Dim db As DAO.Database
Dim tb As DAO.TableDef
Set db = CurrentDb
For Each tb In db.TableDefs
@JamesSkemp
JamesSkemp / Sitecore Link from Item.cs
Last active August 29, 2015 13:56
Create a link given a Sitecore Item.
@JamesSkemp
JamesSkemp / Sitecore Find Locked Items.sql
Created February 20, 2014 16:10
Searches the Sitecore database for locked items.
use XXX_Sitecore_Master
select f.ItemId, f.Value, f.Created, f.Updated, i.Name
from VersionedFields f
left join Items i on f.ItemId = i.ID
where f.Value like '<r owner%'
order by f.Value
@JamesSkemp
JamesSkemp / Check Elmah Database usage.sql
Created March 6, 2014 22:45
Check's database usage for Elmah error logs.
use aspnetdb
exec sp_spaceused elmah_error
@JamesSkemp
JamesSkemp / Sitecore Find published items created and deleted.sql
Created April 11, 2014 18:53
Find items created and deleted as part of a recent Sitecore publish.
use XXX_Sitecore_Web
select top 100 h.Action, h.Category, h.ItemId, h.ItemVersion, h.ItemPath, h.UserName, h.Created
--select count(*)
from History h
where UserName = 'user'
and Created <= '2014-04-11 17:11:36.870'
and Created >= '2014-04-11 17:00:59.963'
-- Created and Deleted items are potentially disruptive changes. The rest could be bad, but ...
and h.Action in ('Created', 'Deleted')
@JamesSkemp
JamesSkemp / SitecoreFQ-SublayoutUsage
Created June 18, 2014 16:26
Sitecore - Fast query to find sublayout usage
fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']
@JamesSkemp
JamesSkemp / Sitecore-Administrators.cs
Created July 14, 2014 20:06
Find Sitecore users with an Administrator Flag (may return some false positives)
// query against XXX_Sitecore_Core
var adminUsers = from profile in Aspnet_Profiles
join user in Aspnet_Users on profile.UserId equals user.UserId
where profile.PropertyNames.Contains("Administrator")
&& profile.PropertyValuesString.Contains("True")
select new { Profile = profile, User = user }
;
adminUsers
.OrderBy (u => u.User.LastActivityDate)
@JamesSkemp
JamesSkemp / Rails Starter commands.bat
Created August 10, 2014 11:56
Commands to get started with a Ruby on Rails site
# start where you want the project directory to be created
# create a new directory for an application. pass -B to skip adding bundles (requires internet connection)
rails new application_name
# start in main project directory
# must run commands for a project out of bin directory
cd bin
# start Rails WEBrick server (on port 3000). ctrl + c will kill it
rails server
# create a new scaffold (object and CRUD)
@JamesSkemp
JamesSkemp / Get started with Atom
Last active August 29, 2015 14:05
Get started with Atom
# run as administrator
# if you haven't already, execution policy will need to be relaxed. This probably returns Restricted
Get-ExecutionPolicy
# switch to a lax policy
Set-ExecutionPolicy Unrestricted
# install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))