Skip to content

Instantly share code, notes, and snippets.

@technomaz
technomaz / Restore-Sitecore-items.ps1
Last active August 2, 2018 01:42
Sitecore Powershell script to restore items from recycle bin archived after a certain date (e.g. recently deleted)
[datetime]$archivedDate = [datetime]::Today.AddDays(-1)
Write-Host "Restoring items recycled after $($archivedDate.ToShortDateString())"
foreach($archive in Get-Archive -Name "recyclebin") {
Write-Host " - Found $($archive.GetEntryCount()) entries"
$entries = $archive.GetEntries(0, $archive.GetEntryCount())
foreach($entry in $entries) {
if($entry.ArchiveLocalDate -ge $archivedDate) {
Write-Host "Restoring item: $($entry.OriginalLocation) {$($entry.ArchivalId)}on date $($entry.ArchiveLocalDate)"
$archive.RestoreItem($entry.ArchivalId)
@technomaz
technomaz / gist:bd3382b0de36a0d5c48b
Created December 31, 2014 18:19
jQuery on DOM ready
jQuery().ready(function() {
// content here
});
@technomaz
technomaz / gist:24ee35868e533c8ba5b2
Created December 31, 2014 18:18
Add Bootstrap icon to all links with /Secure/ in the path that do not have the btn class
jQuery("a[href*='/Secure/']:not(.btn)").after(" <i class=\"icon-lock\"></i>");
@technomaz
technomaz / gist:dad88cf55fb62c335b7a
Created December 31, 2014 18:18
Add Bootstrap icon to all PDF links that do not have the btn class
jQuery("a[href$='.pdf']:not(.btn)").after(" <i class=\"icon-file-text-alt\"></i>");
@technomaz
technomaz / gist:b3c1de31f68541f550c0
Created December 30, 2014 22:26
Use winscp in cfexecute to upload file to linux server
<cfexecute name="C:\download\WinScp\winscp.com" arguments="/command ""open sftp://user:pass@yourserver.com"" ""put c:\full\path\to\file.txt /usr/local/remote/dir/"" ""exit""" variable="result" errorvariable="errorv" timeout="10"></cfexecute>
<cfoutput>
<cfif len(errorv)>
<h1>Error</h1>
<pre>#errorv#</pre>
<cfelse>
<h1>Result</h1>
<pre>#result#</pre>
</cfif>
</cfoutput>