Skip to content

Instantly share code, notes, and snippets.

View cwparsons's full-sized avatar

cwparsons

View GitHub Profile
@cwparsons
cwparsons / termsetAsTree.js
Last active March 21, 2018 10:03
A method to get SharePoint term sets return as trees of JSON objects
/*!
* Termset utilities
*/
var Hcf = Hcf || {};
Hcf.Util = Hcf.Util || {};
Hcf.Util.Termset = Hcf.Util.Termset || {};
(function(module) {
@cwparsons
cwparsons / _mixins_list-properties.less
Last active August 29, 2015 14:02
List various properties with corresponding variables
// Mixin
.list-properties(@property, @list, @index: length(@list)) when (@index > 0) {
.list-properties(@property, @list, (@index - 1));
@value: extract(@list, @index);
&-@{value} {
@{property}: @value;
}
}
@cwparsons
cwparsons / steam-autocard-seller.bookmarklet.js
Last active August 29, 2015 13:56
Helps speed up the process of selling cards on Steam by calculating the average price over the past week.
javascript:(function()%7B(function(g%2Cl%2Cm%2Cb)%7Bfunction%20n(a)%7Bif(a.responseJSON%26%26a.responseJSON.prices)%7Ba%3Da.responseJSON.prices%3Bfor(var%20d%3D0%2Ce%3D0%2Cc%3Da.length-1%2Cb%3Dh.hours%3B0%3C%3Dc%26%260%3C%3Db%3Bc--%2Cb--)%7Bvar%20f%3DparseInt(a%5Bc%5D%5B2%5D.replace(%22%20sold%22%2C%22%22))%3B0!%3D%3Df%26%26(e%2B%3Df%2Cd%2B%3Da%5Bc%5D%5B1%5D*f)%7Da%3DMath.ceil(d%2Fe*100*h.taxes)%2F100%3Bg(%22market_sell_buyercurrency_input%22).value%3D%22%24%22%2Ba%3Bm.OnBuyerPriceInputKeyUp()%3Bg(%22market_sell_dialog_accept_ssa%22).checked%3D%22checked%22%7Delse%20k(a)%7Dfunction%20k(a)%7Bconsole.log(%22Failure%20to%20get%20request%22%2Ca)%7Dvar%20h%3D%7Btaxes%3A1.1%2Chours%3A168%7D%3Bdocument.querySelectorAll(%22.item_market_action_button%22)%5B0%5D.click()%3BsetTimeout(function()%7Bnew%20l.Request(%22http%3A%2F%2Fsteamcommunity.com%2Fmarket%2Fpricehistory%2F%22%2C%7Bmethod%3A%22get%22%2Cparameters%3A%7Bappid%3Ab.appid%2Cmarket_hash_name%3Ab.selectedItem.market_hash_name%7D%2ConSuccess%3An%2ConFailure%3Ak%
@cwparsons
cwparsons / dev-sp-vs2012.custom.txt
Last active January 3, 2016 15:39
Custom boxstarter script
# Run the following
# START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/cwparsons/8483899/raw/b5fc2939b2986dab8e4850ead2e03811ddc21a43/dev-sp-vs2012.custom.txt
#-------------------------------------------------
cinst fiddler4
cinst GoogleChrome
cinst 7zip.install
cinst TeraCopy
@cwparsons
cwparsons / discussionList.js
Created January 14, 2014 20:23
Using JS Link to override out of the box strings in SharePoint 2013
(function() {
// String overrides
function stringOverrides() {
Strings.STS.L_SPDiscHeroLinkFormat = "Create new discussion";
Strings.STS_L.SPDiscSortMyPosts = "Mine";
}
ExecuteOrDelayUntilScriptLoaded(stringOverrides, "initstrings.js");
ExecuteOrDelayUntilScriptLoaded(stringOverrides, "strings.js");
@cwparsons
cwparsons / reddit-user-flair-templates.js
Last active January 2, 2016 05:59
Automate user flair template entries for Reddit
/*!
* Automate user flair template entries for Reddit
* Christopher Parsons <[email protected]>
*/
// Configuration
var timeout = 500,
flairs = [
{ text: '', css: 'Logo1'},
{ text: '', css: 'Logo2'},