This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPangram(string){ | |
return (string.match(/([a-z])(?!.*\1)/ig) || []).length === 26; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Rename-Files.ps1 | |
#> | |
# Find all wmv-files with a string "oldstring" and replace "oldstring" with "newstring" in the filename | |
Get-ChildItem *.wmv -Filter "*oldstring*" | ForEach { Rename-Item $_ -NewName $_.Name.Replace("oldstring","newstring") } | |
# Change the file extension of all .jpeg files to .jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example data | |
var selector = '.ytd-thumbnail-overlay-resume-playback-renderer'; // CSS selector for red bar indicating video has been watched | |
var exampleUrl = 'https://www.youtube.com/channel/UCN64HIrZNqFQYZ2BuyY-4zg'; // example URL for text | |
var jQueryInjectorExtension = 'https://chrome.google.com/webstore/detail/jquery-injector/ekkjohcjbjcjjifokpingdbdlfekjcgi?hl=en'; // url for chrome extension to inject jQuery into page for code below to run | |
$(selector) | |
.parent() // ytd-thumbnail-overlay-resume-playback-renderer.style-scope.ytd-thumbnail | |
.parent() // div#overlays.style-scope.ytd-thumbnail | |
.parent() // a#thumbnail.yt-simple-endpoint.inline-block.style-scope.ytd-thumbnail | |
.parent() // ytd-thumbnail.style-scope.ytd-grid-video-renderer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the owner account/group | |
$Account = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList 'BUILTIN\Administrators'; | |
# Get a list of folders and files | |
$ItemList = Get-ChildItem -Path D:\Applications\Leafletdrop.Q4CmsChange\Media\Default -Recurse; | |
# Iterate over files/folders | |
foreach ($Item in $ItemList) { | |
$Acl = $null; # Reset the $Acl variable to $null | |
$Acl = Get-Acl -Path $Item.FullName; # Get the ACL from the item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
# Define the owner account/group | |
$Account = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList 'Everyone'; | |
$Source = 'D:\Applications\Leafletdrop.Q4CmsChange' | |
# Get a list of folders and files | |
$ItemList = Get-ChildItem -Path $Source -Recurse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = "An example. Another example. This is omitted"; | |
s = s?.Substring(0, s.LastIndexOf(". ")+2); // cuts back to last full sentence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = "An example. Another example. This is omitted"; | |
s = s?.Substring(0, Math.Min(s.Length, Model.NewsMaxChars)); | |
s = s?.Substring(0, s.LastIndexOf(". ")+2); // cuts back to last full sentence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('umbraco').directive('switch', function () { | |
return { | |
restrict: 'AE', | |
replace: true, | |
transclude: true, | |
template: function (element, attrs) { | |
var html = ''; | |
html += '<span'; | |
html += ' class="switcher' + (attrs.class ? ' ' + attrs.class : '') + '"'; | |
html += attrs.ngModel ? ' ng-click="' + attrs.ngModel + '=!' + attrs.ngModel + '"' : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#element').mousedown(function(event) { | |
switch (event.which) { | |
case 1: | |
alert('Left Mouse button pressed.'); | |
break; | |
case 2: | |
alert('Middle Mouse button pressed.'); | |
break; | |
case 3: | |
alert('Right Mouse button pressed.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpContextBase wrapper = new HttpContextWrapper(HttpContext.Current); | |
UmbracoBackOfficeIdentity user = wrapper.GetCurrentIdentity(true); | |
bool isLoggedIn = user != null; |