Skip to content

Instantly share code, notes, and snippets.

View ryanwebjackson's full-sized avatar

Ryan Jackson ryanwebjackson

View GitHub Profile
robert [9:41 AM]
argh i hate how csharp handles
```return x
&& y
&& z == a ? b : c;
```
[9:41 AM]
you need `( )` around that last one after the `&&` (edited)
"The Expense" tv series built on the books
@ryanwebjackson
ryanwebjackson / printStringLength.fs
Created January 9, 2018 22:12
I'm not sure why this doesn't work - still a novice in FSharp, it seems.
open System
let stringifyMe myInt =
myInt.ToString()
printf stringifyMe String.length ("👨‍👩‍👧‍👦")
@ryanwebjackson
ryanwebjackson / gettingCrazy.go
Created November 18, 2017 22:20
Still trying to understand how the assignments are working here
package main
import "fmt"
const (
tomato, apple int = iota + 1, iota + 2
orange, chevy
ford, _
)
function uptime() {
(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | Format-Table
}
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<WebHttpBehavior />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
It's not the same because opinionation is on a sliding scale orthogonal to abstraction. Boiled down -- Opinions == expression to satisfy a goal, Abstraction -- hiding something by making its interface more generic. I think a good example of these concepts is the OSI model - different protocols exist at each layer (level of abstraction), but they have varying degrees of opinions (leave more or less up to you, the programmer)
public class EasyEnum<T> : IEnumerable<object>
{
private List<object> _values;
private Type underlyingType;
public EasyEnum()
{
if (typeof(T).IsSubclassOf(typeof(Enum)))
{
this.underlyingType = Enum.GetUnderlyingType(typeof(T));
$rootDriveAsString = Get-PSDrive
| Where-Object { $_.Provider.Name -eq "FileSystem" }
| Where-Object { (Get-WmiObject Win32_OperatingSystem).SystemDirectory.Contains($_.Root) -and $_.Root -ne "" }
private DateTime? FloorDatetimeToDayPrecision(DateTime? inDatetime)
{
if (inDatetime.HasValue && inDatetime.Value.TimeOfDay > TimeSpan.MinValue)
{
var oldDatetime = inDatetime.Value;
return new DateTime(oldDatetime.Year, oldDatetime.Month, oldDatetime.Day, 0, 0, 0);
}
else
{
return inDatetime;