This file contains hidden or 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
/// <summary> | |
/// These are short programming challenges, can be solved with a single LINQ expression. Of course, that might not | |
/// always make for the most readable code, so feel free to solve these with or without the help of LINQ, and of course | |
/// solutions in other languages are welcome. If you're using LINQ, then the MoreLINQ library often has extension | |
/// methods that simplify the task. | |
/// </summary> | |
/// <remarks>https://markheath.net/post/linq-challenge-3</remarks> | |
/// <remarks>https://github.com/morelinq/MoreLINQ</remarks> | |
public class LinqChallenge3 | |
{ |
This file contains hidden or 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
public static partial class LinqExtensions | |
{ | |
public static Maybe<C> SelectMany<A, B, C>(this Maybe<A> ma, Func<A, Maybe<B>> f, Func<A, B, C> select) => ma.Bind(a => f(a).Map(b => select(a, b))); | |
} |
This file contains hidden or 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
public static class ExtensionMethods { | |
public static string ToHex(this byte[] data) { | |
return ToHex(data, ""); | |
} | |
public static string ToHex(this byte[] data, string prefix) { | |
char[] lookup = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; | |
int i = 0, p = prefix.Length, l = data.Length; | |
char[] c = new char[l * 2 + p]; | |
byte d; | |
for(; i < p; ++i) c[i] = prefix[i]; |
This file contains hidden or 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
[Command("purge")] | |
[Alias("clean")] | |
[Summary("Downloads and removes X messages from the current channel.")] | |
[RequireUserPermission(ChannelPermission.ManageMessages)] | |
[RequireBotPermission(ChannelPermission.ManageMessages)] | |
public async Task PurgeAsync(int amount) | |
{ | |
// Check if the amount provided by the user is positive. | |
if (amount <= 0) | |
{ |
This file contains hidden or 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
private static string convertWildcardToRegex(string pattern) | |
{ | |
// http://stackoverflow.com/a/6907849/107625 | |
// http://www.codeproject.com/Articles/11556/Converting-Wildcards-to-Regexes | |
return "^" + Regex.Escape(pattern). | |
Replace("\\*", ".*"). | |
Replace("\\?", ".") + "$"; | |
} |
This file contains hidden or 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
{ | |
"__comment": "Took from http://tvtropes.org/pmwiki/pmwiki.php/Main/VideogameGenres you need to do the grouping in your script to combine the incompatible genres!", | |
"genres": | |
{ | |
"Action-Adventure": "A game that combines parts from Adventure Games and Action Games together.", | |
"Metroidvania": "A game that combines parts from Adventure Action Games and Platform Games together. Features emphasis on exploring an interconnected environment and obtaining skills necessary to reach new areas of said environment.", | |
"Stealth-Based Game": "A game in which the player character must hide and sneak through the level while avoiding notice from much more powerful enemies that the player character cannot take head-on.", | |
"Survival Sandbox": "A game where the primary objective is to survive for as long as possible in a hostile environment. Also known as Survival Game.", | |
"Survival Horror": "A game that features overwhelmed protagonist(s), oppressive atmosphere based on Horror conventions and a need for c |
This file contains hidden or 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
// ==UserScript== | |
// @name Steam Profile Showcase Organizer | |
// @namespace http://sergiosusa.com | |
// @version 0.1 | |
// @description Add some features to the profile edit page on Steam. | |
// @author Sergio Susa ([email protected]) | |
// @match https://steamcommunity.com/id/*/edit | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
[data-tag=replied] { | |
background-color: #ebdbde!important; | |
color: #662e37 !important; | |
} |
This file contains hidden or 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
[data-tags=red] { | |
background-color: #fffafb !important; | |
color: #942335 !important; | |
font-weight: normal !important; | |
} | |
[data-tags=red] [data-tag] { | |
border: solid 1px #e6cbcb | |
} |
This file contains hidden or 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
using System.Collections.Generic; | |
using UnityEngine; | |
public static class ExtensionMethods | |
{ | |
#region List | |
public static void ShuffleList<T>(this List<T> list) | |
{ | |
List<T> tempList = list; | |
for (int i = 0; i < tempList.Count; i++) |