Skip to content

Instantly share code, notes, and snippets.

View mtsknn's full-sized avatar
😎

Matias Kinnunen mtsknn

😎
View GitHub Profile
@mtsknn
mtsknn / binary-palindrome.ts
Created June 20, 2023 09:51
"Find out if the binary representation of a number is a palindrome or not."
function palindrome(number: number) {
if (number < 0) throw new TypeError('number must be non-negative')
const binary = number.toString(2)
return binary === [...binary].reverse().join('')
}
palindrome(3) //=> true
palindrome(33) //=> true
palindrome(333) //=> false
@mtsknn
mtsknn / README.md
Created October 22, 2022 07:22
Karkkainen.com bookmarklet

Karkkainen.com, a Finnish webshop, doesn't have a search filter to filter out items that are not available in the store in Oulu (the city I live in). That's silly.

This bookmarklet checks all items on the current page (search results page or category page) and then grays out unavailable items and highlights available items.

Sometimes the bookmarklet gets stuck for some reason. Just run it again. :D

This was very quicly thrown together (no shit, Sherlock).

@mtsknn
mtsknn / EpiServer.UpdateModifiedDate.cs
Created March 10, 2021 06:01 — forked from kimgunnarsson/EpiServer.UpdateModifiedDate.cs
Episerver: Update Modified Date for Usages of specific PageType
var contentRepo = ServiceLocator.Current.GetInstance<IContentRepository>();
var contentTypeRepo = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var contentType = contentTypeRepo.Load(typeof (PageData));
var usageRepo =
ServiceLocator.Current.GetInstance<IContentModelUsage>()
.ListContentOfContentType(contentType)
.Select(x => x.ContentLink.ToReferenceWithoutVersion()).Distinct()
.ToList();