Skip to content

Instantly share code, notes, and snippets.

@zippy1981
zippy1981 / DeepCopyTest.ps1
Created March 9, 2012 14:54
PowerShell Deepcopy demo
# Get original data
$data = @{
First = 'Justin';
Last = 'Dearing';
Resume = @{
Experience = [HashTable[]]@(
@{
StartDate = [DateTime] (Get-Date '2002-03-23');
EndDate = [DateTime] (Get-Date '2007-05-15');
Company = 'ACME ISP';
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@kamsar
kamsar / gist:6407742
Created September 1, 2013 22:29
This class provides a method to 'upgrade' the hash algorithm used by the SqlMembershipProvider without resetting all existing passwords. Users can effectively then be authenticated using either legacy or modern hashes, and any time a hash gets touched it will be upgraded automatically.
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web.Security;
@kamsar
kamsar / async.cs
Created October 29, 2013 02:02
Demonstration of using async to grab a bunch of Sitecore queries in parallel Performance on a dual-core machine appeared to be 30-100% faster than iterative.
using System.Linq;
using Isite.Sitecore.UI.WebControls;
using Isite.Extensions;
using System.Web.UI;
using System.Threading.Tasks;
using Sitecore.Data.Items;
using System.Collections.Generic;
using System.Threading;
using Sitecore.Caching;
using System.Diagnostics;
@rxaviers
rxaviers / gist:7360908
Last active May 5, 2024 06:01
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@wormeyman
wormeyman / Source_Code_Pro_Powershell_font.ps1
Last active March 10, 2020 10:26
Set Adobe's Source Code Pro as a PowerShell font option.
#Reference: http://michaellwest.blogspot.com/2013/03/add-font-to-powershell-console.html
#Reference: http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q247815 This explains why we name it 000
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont' #Get the properties of TTF
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont' -Name 000 -Value 'Source Code Pro' #Set it to SCP
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont' #Check to see if we properly set it so that SCP is an option
@michaellwest
michaellwest / Relink Sitecore Image.ps1
Last active August 3, 2021 07:46
Demonstrates how to relink images using Sitecore PowerShell Extensions. Comment included by Dylan shows how to Remove the link and remove the item.
@jokecamp
jokecamp / gist:2c1a67b8f277797ecdb3
Last active January 31, 2024 01:48
Powershell HMAC SHA 256 Example
# Powershell HMAC SHA 256
$message = 'Message'
$secret = 'secret'
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256
$hmacsha.key = [Text.Encoding]::ASCII.GetBytes($secret)
$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message))
$signature = [Convert]::ToBase64String($signature)
@fearthecowboy
fearthecowboy / TestThis.cs
Created October 21, 2014 15:52
Modifying the validation set for a compile-time powershell parameter
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Management.Automation;
using System.Reflection;
using System.Threading;
namespace parametertest
{
@pgilad
pgilad / Instructions.md
Last active March 31, 2024 22:30
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example