Skip to content

Instantly share code, notes, and snippets.

View plcancelleri's full-sized avatar
🦏
...

P. L. Cancelleri plcancelleri

🦏
...
View GitHub Profile
@kuhlenh
kuhlenh / .editorconfig
Last active October 4, 2021 04:56
Roslyn .NET OSS (WIP)
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space
# Code files
@vkhorikov
vkhorikov / 1.cs
Last active October 7, 2020 17:36
Value Object
public abstract class ValueObject<T>
where T : ValueObject<T>
{
public override bool Equals(object obj)
{
var valueObject = obj as T;
if (ReferenceEquals(valueObject, null))
return false;
@TLaborde
TLaborde / gist:22359e9029f3bc03872c208406d64d5d
Created April 12, 2016 07:38
Using powershell for "realtime" notification on a dashboard
As requested on reddit, here is some information about how i made a "realtime" dashboard.
Flow
===
1. a task grab data with a scheduled job. It saves the data in json in two places: one static folder, which overwrite existing data, and in a temporary folder, to be a new "event".
2. a websocket deamon (websocketd) run a powershell script listening to changes in the temporary folder. When a change happens, the new data is read and sent thru the websocket
3. the frontend update the data with what came thru the websocket. If the browser does not support websocket, it will instead pull the data from time to time
Grabbing Data and saving as JSON
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@BryanWilhite
BryanWilhite / sample.cs
Created January 20, 2016 00:34
LinqPad: Animation Study
void Main()
{
var xaml = @"
<UserControl
xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:sys=""clr-namespace:System;assembly=mscorlib"">
<UserControl.Resources>
<Style TargetType=""{x:Type Button}"">
<Setter Property=""Height"" Value=""32"" />
@staltz
staltz / introrx.md
Last active July 25, 2024 16:52
The introduction to Reactive Programming you've been missing
@mikeminutillo
mikeminutillo / gist:8346775
Created January 10, 2014 03:58
Embed Google Chart API graph into LINQPad Results window
Util.RawHtml(@"<script type=""text/javascript"" src=""https://www.google.com/jsapi""></script>").Dump();
Util.RawHtml(@"<div id=""chart_div"" style=""width: 1024px; height: 1024px;""></div>").Dump();
var script = new StringBuilder();
script.AppendLine(@"
<script type=""text/javascript"">
google.load(""visualization"", ""1"", {packages:[""corechart""]});
google.setOnLoadCallback(drawChart);
function drawChart() {
@ijy
ijy / sublime-text-3-setup.md
Last active January 15, 2024 14:21
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@swlaschin
swlaschin / type-dependency-graph.fsx
Last active July 23, 2024 10:36
This script analyzes the dependencies between top level types in a .NET Assembly. It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download
@kbrammer
kbrammer / LINQPadSearchFileContents.cs
Created May 3, 2013 18:09
Extension methods to enumerate files and directories, include or exclude by name or extension, and search file contents. Example is in LINQPad format.
void Main()
{
string path = Path.GetFullPath(@"C:\Users\Username");
System.IO.DirectoryInfo di = new DirectoryInfo(path);
var query = di.GetFiles("*.*",SearchOption.TopDirectoryOnly).IncludeFileExtensions("*.asp").SearchFileContents("searchterm");
query.Dump();
}
public static class FileIOExtensions