Skip to content

Instantly share code, notes, and snippets.

View lukewilson2002's full-sized avatar

Luke Wilson lukewilson2002

View GitHub Profile
@lukewilson2002
lukewilson2002 / readme.md
Last active March 31, 2025 15:04
How to setup TailwindCSS and DaisyUI with an ASP.NET Core 9 Razor Pages project

How to setup TailwindCSS and DaisyUI with an ASP.NET Core 9 Razor Pages project

First, create your ASP.NET Core Razor Pages / MVC / Blazor project if you haven't already.

Initialize an NPM Package

Open a terminal in your project folder (not the solution folder!) and run the following to initialize an NPM package, which in our case only serves to download tailwindcss and daisyui:

use std::rc::Rc;
use std::cell::RefCell;
pub struct Character {
pub display_name: String,
// TODO: ability to store arbitrary properties
}
impl Character {
pub fn new(name: impl Into<String>) -> Character {
@lukewilson2002
lukewilson2002 / main.zig
Created February 23, 2021 23:50
Scale integers from of larger size to integers of a smaller size
const std = @import("std");
const maxInt = std.math.maxInt;
fn scaleInt(comptime DestType: type, val: anytype) DestType {
if (@bitSizeOf(@TypeOf(val)) > 16) {
@compileError("Function unsafe for values of bitsize greater than 16.");
}
const fv = @intToFloat(f32, val) / @intToFloat(f32, maxInt(@TypeOf(val))); // make ratio
return @floatToInt(DestType, fv * maxInt(DestType) + 0.5);
}
@lukewilson2002
lukewilson2002 / copy.zig
Last active September 15, 2020 16:59
Copying files from a directory recursively with Zig...
/// Copy a source directory's files and its subdirectories' files to a destination. Will only copy directories and files.
fn copyRecursiveDir(src_dir: fs.Dir, dest_dir: fs.Dir, src_path: []const u8, dest_path: []const u8) anyerror!void {
var iter = src_dir.iterate();
while (true) {
const entry = try iter.next();
if (entry == null) {
break;
} else {
switch (entry.?.kind) {
.File => try src_dir.copyFile(entry.?.name, dest_dir, entry.?.name, fs.CopyFileOptions{}),
@lukewilson2002
lukewilson2002 / friendly_coding_communities.md
Created May 25, 2020 02:37
A list of friendly programming communities.

Friendly Programming Communities

It's important that you connect with a community for something you want to learn, because it will help ease the learning process.

Discord

Discord is my preferred method of chatting. It's a good app, a lot of people use it. It's like the new Skype.

  1. The Handmade Network - Very talented people... let 'em know you're a newbie and you want guidance.
  2. Game Dev League - A community of hobbyist game developers.
  3. The Shebang - A smaller community of software developers. I used to co-own it. Drop me an @ ... I'm Code Messiah.
@lukewilson2002
lukewilson2002 / build.zig
Last active November 13, 2019 14:22
Bounce a ball horizontally in your terminal window. This uses the `@cInclude` Zig feature and creates a very weak wrapper over the required ncurses features. You will need ncurses installed, and for Ubuntu-based systems it's as easy as `sudo apt install libncurses-dev`.
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("qubit", "src/main.zig");
exe.setBuildMode(mode);
exe.linkSystemLibrary("c"); // link with libc
exe.linkSystemLibrary("ncurses"); // link with ncurses.a (requires ncurses be installed where program is run)
@lukewilson2002
lukewilson2002 / GuessingGame.java
Created October 29, 2019 12:56
A pseudo-programming language made to overengineer a guessing game.
/*
NUMBER GUESSING DOMAIN-SPECIFIC LANGUAGE IN JAVA
BY LUKE I. WILSON
*/
package org.vv;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Random;
package main
import (
"bufio"
"fmt"
"os"
"strings"
"time"
)
@lukewilson2002
lukewilson2002 / heron.go
Last active September 15, 2019 21:12
A program to compute inverses of numbers (requires Go 1.13+ for floating-point hex)
package main
import (
"fmt"
"os"
"strconv"
)
const (
eps1m01 float64 = 1.0 - 0x1P-01
hello, friend, it is me george ohwell is back bitches