Skip to content

Instantly share code, notes, and snippets.

// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2013
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@sinbadsoft.com</email>
@AlienHoboken
AlienHoboken / valve-data-format-jsonify.php
Last active October 14, 2021 15:31
This short PHP script will create valid JSON data from Valve Data Format (VDF) data, such as items_game.txt files for TF2 and DotA 2. This allows for much greater ease in parsing the data it contains.
<?php
//load VDF data either from API call or fetching from file/url
//no matter your method, $json must contain the VDF data to be parsed
$json = file_get_contents("items_game.txt");
//encapsulate in braces
$json = "{\n$json\n}";
//replace open braces
$pattern = '/"([^"]*)"(\s*){/';
@axefrog
axefrog / 0.suffixtree.cs
Last active July 12, 2023 01:01
C# Suffix tree implementation based on Ukkonen's algorithm. Full explanation here: http://stackoverflow.com/questions/9452701/ukkonens-suffix-tree-algorithm-in-plain-english
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{