This code creates a UART TX on 8 sequential pins of the Raspberry Pi Pico. The main use case being MIDI splitter devices
The second 16 port implementation should work for any number of pins, but just acts as a pure copy to those pins instead of having individual control over every pin of every byte. Hence while less flexible, the controlling software is simpler (just send a uart byte and it's copied to every pin).
Only tested in the simulator so far. https://wokwi.com/projects/344345628967436882
Used https://wokwi.com/tools/pioasm to go from uart_tx.pio.h to uart_tx.h
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
// ... | |
protected void Application_BeginRequest(object sender, EventArgs e) | |
{ | |
switch (Request.Url.Scheme) | |
{ | |
case "http": | |
RedirectToHttps(); | |
break; | |
case "https": | |
AddStsHeader(); |
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.Collections.Generic; | |
namespace GameOfLife1 | |
{ | |
struct Cell | |
{ | |
public Cell(int x, int y) : this() | |
{ | |
Y = y; | |
X = x; |
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
class Foo | |
{ | |
List<Person> _people = new List<Person>(); | |
IEnumerable<Person> Drinkers() | |
{ | |
return people.Where(p => p.Age >= 18); | |
} | |
IEnumerable<Person> Drinkers2() | |
{ |
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
// http://devlicio.us/blogs/derik_whittaker/archive/2012/10/20/how-to-split-a-list-into-chunks-fun-code.aspx | |
static class GroupingExtensions | |
{ | |
public static IEnumerable<IEnumerable<T>> GroupByCount<T>(this IEnumerable<T> source, int count) | |
{ | |
if (source == null) throw new ArgumentNullException("source"); | |
return GroupByCountIterator<T>(source, count); | |
} |
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; | |
using System.Collections; | |
using System.Data; | |
namespace TestDataTableBuilder | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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 ClassToBeTested | |
{ | |
public static void DoSomething(int input, AnotherCrazyPublicStaticClass staticClass) | |
{ | |
var result = staticClass.MethodToBeMocked(input); // go hit the database, network, web services, file and everything else you can imagine. | |
// now some business logic that I want to test | |
// 400 lines of code | |
// if result is blah do x otherwise do y | |
// 20 foreach loops each one with 2 nested loops and 10 if conditions. | |
} |
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 class MainViewModel : ViewModelBase | |
{ | |
public MainViewModel() | |
{ | |
ActivityProcessor processor = new ActivityProcessor(); | |
GetUnicornsCommand = processor.CreateCommand(GetUnicorns).WithContinuation(HandleGetUnicornErrors); | |
} | |
IEnumerable<IActivity> GetUnicorns() | |
{ |
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
private static IEnumerable<TSource> SkipWhileImpl<TSource>( | |
IEnumerable<TSource> source, | |
Func<TSource, bool> predicate) | |
{ | |
using (IEnumerator<TSource> iterator = source.GetEnumerator()) | |
{ | |
do | |
{ | |
if (!iterator.MoveNext()) | |
yield break; |
NewerOlder