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
namespace RomTile; | |
using SixLabors.ImageSharp; | |
using SixLabors.ImageSharp.PixelFormats; | |
internal static class Program | |
{ | |
private const int TileWidth = 8; | |
private const int TileHeight = 8; | |
private const int NumberOfPixelsInATile = TileWidth * TileHeight; |
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
namespace MonoGameCross_PlatformDesktopApplication1 | |
{ | |
using Microsoft.Xna.Framework; | |
using Microsoft.Xna.Framework.Graphics; | |
using Microsoft.Xna.Framework.Input; | |
public static class Program | |
{ | |
[STAThread] | |
private static void Main() |
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.Text; | |
public static class AutoGarbage | |
{ | |
private const string Chars = "qwertyuiopasdfghjklzxcvbnm1234567890"; | |
public static T Next<T>(this Random random) => (T)Next(random, typeof(T)); | |
private static object Next(this Random random, Type type) | |
{ |
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
namespace MyApp.Domain | |
{ | |
using Ardalis.GuardClauses; | |
public class CountryCode | |
{ | |
public CountryCode(string value) => Value = Guard.Against.UnknownCountryCode(value, nameof(value)); | |
public string Value { get; } | |
} |
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
namespace OneHour | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Xunit; | |
internal class Command | |
{ | |
public enum CommandKind |
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
import SwiftUI | |
struct ContentView: View { | |
@State var gradient = [ | |
Color.red, .orange, .yellow, .green, .blue, .purple, Color.red, .orange, .yellow, .green, .blue, .purple, | |
] | |
@State var startPoint = UnitPoint(x: 0, y: -1) | |
@State var endPoint = UnitPoint(x: 0, y: 1) |
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
import SwiftUI | |
struct AnimalView: View { | |
var model: Animal | |
var body: some View { | |
VStack { | |
Image(systemName: model.systemImageName) | |
.resizable() | |
.scaledToFit() |
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
func makePNG(_ size: NSSize, by drawing: (CGContext) -> ()) -> Data? { | |
guard let bitmapImageRep = NSBitmapImageRep(bitmapDataPlanes: nil, | |
pixelsWide: Int(size.width), | |
pixelsHigh: Int(size.height), | |
bitsPerSample: 8, | |
samplesPerPixel: 4, | |
hasAlpha: true, | |
isPlanar: false, | |
colorSpaceName: NSColorSpaceName.deviceRGB, | |
bytesPerRow: 0, bitsPerPixel: 0) else { |
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
import QuartzCore | |
extension CGContext { | |
private static let colorSpace = CGColorSpaceCreateDeviceRGB() | |
private static let bitmapInfo = | |
CGBitmapInfo.byteOrder32Big.rawValue | | |
CGImageAlphaInfo.premultipliedLast.rawValue & CGBitmapInfo.alphaInfoMask.rawValue | |
static func from(pixels: [UInt32], width: Int) -> CGContext? { |
NewerOlder