Skip to content

Instantly share code, notes, and snippets.

View yumaikas's full-sized avatar

Andrew Owen yumaikas

View GitHub Profile
@yumaikas
yumaikas / timers.nushell
Last active May 6, 2023 04:46
Nushell snippet for timers, can be added to config.nu
def-env "timers init" [] {
if not ("~/.timers.nuon" | path exists) {
[{name: _default, start: (date now)}] | save -f ~/.timers.nuon
}
if not ("~/.timers_done.nuon" | path exists) {
[{name: '_default', duration: ((date now) - (date now)), ended: (date now)}] | save -f ~/.timers_done.nuon
}
}
@yumaikas
yumaikas / LoopPosition.cs
Last active January 15, 2021 07:34
Shows if you're at the start, middle, or end of a foreach loop in C#
// This code assumes that it's run as a LinqPad script, but it's just the Main() part that assumes that.
void Main()
{
LoopStatus(new int[]{ 1, 2, 3, 4, 5 }).Dump();
}
// Define other methods and classes here
public enum Iteration {
@yumaikas
yumaikas / calculator.factor
Created August 6, 2018 06:42
An example of a calculator written (probably non-idomatic) factor.
! Copyright (C) 2018 Andrew Owen.
! See http://factorcode.org/license.txt for BSD license.
USING:
ui ui.gadgets ui.gadgets.tracks ui.gadgets.labels ui.gadgets.buttons ui.gadgets.packs ui.tools.operations
ui.pens.solid ui.pens.gradient
colors colors.constants
accessors math.parser vocabs.loader io locals
models models.arrow fry
kernel strings sequences math
;
@yumaikas
yumaikas / about.md
Created June 2, 2016 00:02 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@yumaikas
yumaikas / Count Lines of C#
Last active August 29, 2015 14:09
This is a small PowerShell Script for counting the
#A small script for counting lines of code for projects in a list of C# code
# directories.
# Inspired by
# http://www.limilabs.com/blog/source-lines-of-code-count-using-powershell
# In the interest of berevity, I've used the following standard powershell alias's
# ls = Get-ChildItem
# % = Foreach-Object
# ? = Where-Object
# sort = Sort-Object