Skip to content

Instantly share code, notes, and snippets.

View dylanbeattie's full-sized avatar

Dylan Beattie dylanbeattie

View GitHub Profile
({}+"")[!""+!""]
+ ([] + !""/[])[!![]+!!{}+!""]
+ (![] + "")[!![] << !![]]
+ (![] + "")[!![] << !![]]
+ (!!{}/[]+"")[!![] << !![] <<!![] | !![] << !![] | !![]]
+ ({}+"")[!![] << !![] <<!![] | !![] << !![] | !![]]
+ ({}+"")[!![]<<!![]|!([]/[])]
+ ({}+"")[+!"" ]
+ (""+![])[!![]<<!![]<<!![]]
+ (![] + "")[!![] << !![]]
@dylanbeattie
dylanbeattie / ascii-progress-bar.cs
Last active August 18, 2024 22:12
An ASCII progress bar using a raw carriage return character
Console.WriteLine("Progress bar demo using carriage returns");
const int STEPS = 40;
const string SPINNER = "|/-\\";
var random = new Random();
for (var i = 0; i <= STEPS; i++) {
Console.Write("\r");
Console.Write("Progress: ");
Console.Write(SPINNER[i%4]);
Console.Write(" [");
Console.Write(String.Empty.PadRight(i, '▓').PadRight(STEPS, ' '));
@dylanbeattie
dylanbeattie / while_e_coyote.cs
Created July 1, 2022 13:20
while() {} vs do {} while() loops using Roadrunner and Wile E. Coyote
abstract class Animal {
public int distanceFromEdge = 1;
protected bool edge => distanceFromEdge <= 0;
protected void run() {
distanceFromEdge--;
}
public abstract void go();
}
using System;
using System.Text;
namespace DotNetSummitBy {
class Program {
static NormalizationForm[] forms = new[] {
NormalizationForm.FormC, NormalizationForm.FormD,
NormalizationForm.FormKC, NormalizationForm.FormKD
@dylanbeattie
dylanbeattie / ObjectToDynamic.cs
Last active November 6, 2021 11:20
An extension method on Object in C#, that converts statically-typed objects to dynamic objects with the same structure.
public static class ObjectExtensions {
public static dynamic ToDynamic(this object value) {
IDictionary<string, object> expando = new ExpandoObject();
var properties = TypeDescriptor.GetProperties(value.GetType());
foreach (PropertyDescriptor property in properties) {
expando.Add(property.Name, property.GetValue(value));
}
return (ExpandoObject)expando;
}
}
@dylanbeattie
dylanbeattie / whisper.rock
Created March 2, 2021 21:52
Rockstar: Whisper the Future
Forever takes a lifetime.
The sunset is silence (it seems)
Until a lifetime is nothing,
Roll a lifetime into your dreams,
Cast your dreams into the night,
Let the sunset be with the night.
Give back the sunset
Give back the night
@dylanbeattie
dylanbeattie / ObjectExtensions.cs
Created January 14, 2021 01:41
ObjectExtensions.ToDynamic
public static class ObjectExtensions {
public static dynamic ToDynamic(this object value) {
IDictionary<string, object> expando = new ExpandoObject();
var properties = TypeDescriptor.GetProperties(value.GetType());
foreach (PropertyDescriptor property in properties) {
expando.Add(property.Name, property.GetValue(value));
}
return (ExpandoObject)expando;
}
}
DECLARE @places TABLE (name nvarchar(max));
insert into @places(name) values('Aarhus');
insert into @places(name) values('Berlin');
insert into @places(name) values('Zurich');
insert into @places(name) values('Aachen');
select name from @places order by name COLLATE Latin1_General_CI_AI
select name from @places order by name COLLATE Danish_Norwegian_CI_AI
select name from @places order by name COLLATE Finnish_Swedish_CI_AI
CREATE TABLE RockClub (
ID INT IDENTITY(1, 1),
Address_NS NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AI,
Address_VS VARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AI,
Address_NW NVARCHAR(128) COLLATE Latin1_General_CI_AI,
Address_VW VARCHAR(128) COLLATE Latin1_General_CI_AI
)
INSERT INTO RockClub (Address_NS, Address_VS, Address_NW, Address_VW) VALUES (N'Saarbrücker Straße 24, 10405 Berlin','Saarbrücker Straße 24, 10405 Berlin',N'Saarbrücker Straße 24, 10405 Berlin','Saarbrücker Straße 24, 10405 Berlin')
#parse parameters supplied by TeamCity script step
param (
[string]$branch = "refs/heads/master",
[string]$branch_is_default = "true",
[string]$build_number = "0"
)
function Update-AssemblyVersion {
param ([string]$version)