Skip to content

Instantly share code, notes, and snippets.

@azzlack
azzlack / install.ps1
Last active December 14, 2015 22:59
Sample install.ps1 for a NuGet package that patches the umbracoSettings config file
param($rootPath, $toolsPath, $package, $project)
if ($project) {
$projectDestinationPath = Split-Path $project.FullName -Parent
### Change single element value or attribute ###
$umbracoConfigFile = Join-Path $projectDestinationPath "Config\umbracoSettings.config"
$umbracoConfig = [XML](Get-Content $umbracoConfigFile)
# Set domain prefixes to true
@azzlack
azzlack / ReportingServices.js
Created May 29, 2013 08:01
Code for adding compatibility with Chrome, Safari, FF for SQL Server 2012 SP1 Reporting Services. Append to the file `C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js`
function pageLoad() {
var element = document.getElementById("ctl32_ctl09");
if (element)
{
element.style.overflow = "visible";
}
}
@azzlack
azzlack / gist:6935644
Created October 11, 2013 14:30
Getting auth cookie when using System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler and System.IdentityModel.Services.Tokens.SessionSecurityTokenHandler
// Need to use cookiehandler to get cookie since it's chunked. See System.IdentityModel.Services.ChunkedCookieHandler
var cookie = FederatedAuthentication.SessionAuthenticationModule.CookieHandler.Read();
@azzlack
azzlack / Log4NetLogger.cs
Last active August 29, 2015 14:08
Log4Net logger for Common.Logging
namespace Common.Logging.Log4Net2
{
using System;
using System.Diagnostics;
using Common.Logging;
using Common.Logging.Factory;
using log4net.Core;
@azzlack
azzlack / getColor
Last active August 29, 2015 14:14
Create color from a string
var colors = [
"8dd3c7",
"ffffb3",
"bebada",
"fb8072",
"80b1d3",
"fdb462",
"b3de69",
"fccde5",
"d9d9d9",
@azzlack
azzlack / getContrastColor
Last active August 29, 2015 14:14
Gets the contrast color for a given color
var getContrastColor = function(hexcolor) {
var hex = hexcolor.replace(/[^0-9a-f]/gi, '');
var r = parseInt(hex.substr(0, 2), 16);
var g = parseInt(hex.substr(2, 2), 16);
var b = parseInt(hex.substr(4, 2), 16);
var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
return (yiq >= 128) ? 'black' : 'white';
};
@azzlack
azzlack / changeColorLuminosity
Created February 3, 2015 07:48
Change a colors luminosity
var changeColorLuminosity = function (hexcolor, luminosity) {
var hex = hexcolor.replace(/[^0-9a-f]/gi, '');
// convert to decimal and change luminosity
var rgb = "#", c, i;
for (i = 0; i < 3; i++) {
c = parseInt(hex.substr(i * 2, 2), 16);
c = Math.round(Math.min(Math.max(0, c + (c * luminosity)), 255)).toString(16);
rgb += ("00" + c).substr(c.length);
}
@azzlack
azzlack / gist:e47da479a502a8d29c28
Created March 25, 2015 09:08
Basic Umbraco Contour Workflow
/// <summary>
/// Basic Umbraco Contour Form Workflow.
/// </summary>
public class Workflow : WorkflowType
{
/// <summary>
/// Initializes a new instance of the <see cref="Workflow"/> class.
/// </summary>
public Workflow()
{
@azzlack
azzlack / CreateCertificate
Created April 30, 2015 14:33
Create development certificate for domain with root CA
@echo off
echo.
echo #####################################
echo ## Development Certificate Factory ##
echo ## ##
echo ## by azzlack ##
echo #####################################
echo.
echo Loading paths...
@azzlack
azzlack / transition_issue_when_added_to_or_removed_from_sprint.groovy
Last active August 31, 2021 07:02
JIRA: Transition issue when adding to or removing from sprint
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.service.sprint.SprintIssueService
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.atlassian.greenhopper.service.sprint.SprintService
import org.apache.log4j.Logger
import org.apache.log4j.Level