Skip to content

Instantly share code, notes, and snippets.

View alfredmyers's full-sized avatar

Alfred Myers alfredmyers

View GitHub Profile
@alfredmyers
alfredmyers / TrollingEquality.cs
Created August 17, 2018 11:25
Trolling Equality
public static bool operator ==(Trololoh left, Trololoh right) {
return new Random().Next(2) % 2 == 0;
}
private ISpanned FromHtml(string source)
{
// app specific code
if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
{
return Html.FromHtml(source, FromHtmlOptions.ModeLegacy);
}
#pragma warning disable CS0618 // Type or member is obsolete
@alfredmyers
alfredmyers / gist:4b93a27af706a3a1a70ce2bcbe3b9456
Created January 17, 2018 17:01
msbuild RoslynAnalyzers.sln
This file has been truncated, but you can view the full file.
Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 1/17/2018 14:49:15.
Project "C:\Code\GitHub\dotnet\roslyn-analyzers\RoslynAnalyzers.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Code\GitHub\dotnet\roslyn-analyzers\RoslynAnalyzers.sln" (1) is building "C:\Code\GitHub\dotnet\roslyn-analyzers\src\Roslyn.Diagnostics.Analyzers\Core\Roslyn.Diagnostics.Analyzers.csproj" (2) on node 1 (default targets).
CoreResGen:
@alfredmyers
alfredmyers / BulkNuGetInstall.ps1
Created January 17, 2018 15:54 — forked from aaronpowell/BulkNuGetInstall.ps1
Install NuGet across all projects
#Installs a package into all projects in the solution (note: Requires NuGet 1.1+)
Get-Project -All | Install-Package packageName
@alfredmyers
alfredmyers / DeviceOsTargetPlatformAfter.cs
Created November 23, 2017 12:51
Xamarin.Forms.Device.OS and Xamarin.Forms.TargetPlatform deprecated
if (Device.RuntimePlatform == Device.Android)
{
//platform specific code
}
else if (Device.RuntimePlatform == Device.iOS)
{
//platform specific code
}
_USE_NLS_PLUS_TABLE
ARRAY_GENERIC_METHODS
CODE_ANALYSIS_BASELINE
ETW_SUPPORTED
FEATURE_APPDOMAIN_RESOURCE_MONITORING
FEATURE_APPDOMAINMANAGER_INITOPTIONS
FEATURE_APPX
FEATURE_APPX_BINDER
FEATURE_APTCA
FEATURE_ASCII
@alfredmyers
alfredmyers / TestWindowPackage
Created October 14, 2015 22:21
TestWindowPackage error message
---------------------------
Microsoft Visual Studio
---------------------------
The 'TestWindowPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\alfred.myers\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.
<html>
<head>
</head>
<body>
The JavaScript language
JavaScript
JavaScript
<script type="text/javascript">
"use strict";
var p = /s$/;
// JavaScript aceita divisão por 0:
1 / 0 == Infinite
0 / 0 == NaN
// e o mais curioso:
NaN != NaN
@alfredmyers
alfredmyers / factorial.js
Last active August 29, 2015 14:25
Factorial with memoization
var factorial = (function () {
var cache = [1];
return function factorial(n) {
if(n < 0) {
return Infinity;
}
n = parseInt(n);
if (n < cache.length) {
return cache[n];