Skip to content

Instantly share code, notes, and snippets.

@amake
amake / lg2tmx.xsl
Last active April 26, 2022 01:31
An XSLT to convert Apple *.lg glossaries into TMX
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Convert Apple *.lg glossaries to TMX. Usage:
xsltproc [-o <output file>] [-\-stringparam srclang <source lang>] lg2tmx.xsl <input file>
If not specified, the TMX header's srclang attribute defaults to "*all*".
Get glossaries at https://developer.apple.com/downloads/?name=glossaries -->
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:param name="srclang" select="'*all*'" />
<xsl:template match="/">
<tmx version="1.4">
@thieunguyencrystal
thieunguyencrystal / SmallestPositiveNumber.swift
Created March 21, 2019 11:06
Find the smallest positive number missing from an unsorted array
/*
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
You can modify the input array in-place.
*/
func solution(_ array: [Int]) -> Int {
guard let max = array.max(), max > 0 else { return 1 }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UnifiedBar</key>
<dict>
<key>DisclosureRequired</key>
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string>
<key>Enabled</key>
<false/>