This file contains 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
/* | |
* Input: `20 340400 1 - 20-34-04-00-00001.0-0000.00` | |
* Desired Output: `20 340400 1 - 2something-04different-00001.0-than-what you had` | |
* Repeate the above once or twice more. Preferably generalize it and only give two small examples | |
*/ | |
public static string TransformData(string data) { | |
// ?? This is where I'm having trouble | |
} |
This file contains 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
(function ($) { | |
$.fn.disable = function () { | |
return this.each(function () { | |
$(this).attr("disabled", "disabled"); | |
}); | |
} | |
$.fn.enable = function () { | |
return this.each(function () { | |
$(this).removeAttr("disabled"); | |
}); |
This file contains 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
void Main() | |
{ | |
string fileName = ""; //Whatever the full path to the file in question is | |
var lines = ReadLines(fileName); | |
// Often I apply some filtering/modifying as follows: | |
//.Skip(1) //If you need to skip some number of lines | |
//.Split('\t') //Or ',', or whatever, but only if you want | |
//.GroupBy(line => line[0]) //Again only if you want | |
This file contains 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 void Main() | |
{ | |
Random random = new Random(); | |
Matrix m = new Matrix(GetRandomFirstRow(random)); | |
foreach(Note n in m.Row(0)) | |
{ | |
Console.Beep(n, random.Next(1, 5) * 250); | |
} | |
} |
This file contains 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
void Main() | |
{ | |
string fileName = ""; //Whatever the full path to the file in question is | |
var lines = ReadLines(""); | |
// Often I apply some filtering/modifying as follows: | |
//.Skip(1) //If you need to skip some number of lines | |
//.Split('\t') //Or ',', or whatever, but only if you want | |
//.GroupBy(line => line[0]) //Again only if you want | |
This file contains 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 AppendExtensions | |
{ | |
public static IEnumerable<V> Append<V>(this V val, IEnumerable<V> enumerable) | |
{ | |
yield return val; | |
foreach (V v in enumerable) yield return v; | |
} | |
public static IEnumerable<V> Append<V>(this IEnumerable<V> enumerable, V val) | |
{ |
This file contains 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 void SetupDragging(this ListView list) | |
{ | |
bool insertAfter = false; | |
ListViewItem dragged = null; | |
ListViewItem targetItem = null; | |
list.DrawItem += (o, e) => | |
{ | |
e.DrawDefault = true; | |
if (e.Item != targetItem) return; |
This file contains 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.Reflection; | |
using System.CodeDom.Compiler; | |
using Microsoft.CSharp; | |
dynamic foreignMember = CSharpCodeProvider | |
.CreateProvider("CSharp") | |
.CompileAssemblyFromSource( | |
new CompilerParameters | |
{ | |
GenerateInMemory = true, |
NewerOlder