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 / Sitecore LINQPad search queries.md
Last active March 11, 2016 15:27
Sitecore LINQPad search queries

Sitecore LINQPad search queries

The following queries can be run in LINQPad to run searches against the Sitecore database.

Search for a term in versioned and shared fields.

This script searches against all versioned and shared fields for a search term.

It will return any results from the current version of the item.

@JamesSkemp
JamesSkemp / libGDX atlas file Kenney Roguelike Characters.md
Last active August 29, 2015 14:25
libGDX atlas file for Kenney's Roguelike Characters sprites

The following atlas file can be used by libGDX to reference sprites within Kenney's Roguelike Characters sheet.

Due to an issue with the spritesheet you'll need to:

  1. Move everything from the pants on (so everything but the two columns of people) over to the left one pixel. Based upon this Reddit post, this should be fixed at some point in the future.
  2. Expand the image to 1024x256 pixels.

Once this is done, you can add the following code to your project as a .atlas file. This will give you access to the 448 sprites as part of this sheet.

Get the spritesheet from Kenney's itch.io page. Developed against version 36 of the donation pack.

@JamesSkemp
JamesSkemp / OrthographicCameraController.java
Last active November 1, 2022 17:32
An orthographic camera controller that handles inputs and gestures, for libGDX.
package com.jamesrskemp.libgdx.utils;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.input.GestureDetector;
import com.badlogic.gdx.math.Vector2;
/**
@JamesSkemp
JamesSkemp / Sitecore-FastQueries.md
Last active January 14, 2021 14:20
Sitecore - Fast queries to find items with a particular template/sublayout.

This will find items matching a particular template.

fast://*[@@templateid='{072A5DF2-4283-4043-9A4F-7D1218F4D899}']

Without text in the item name.

fast://*[@@templateid='{0400B345-381D-4BAF-8B83-85DD52632FE5}' and @@name != '%test%']

Created after a certain date.

@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'
@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 / 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 / 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 / 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;