Skip to content

Instantly share code, notes, and snippets.

Brad Phelan bradphelan

Block or report user

Report or block bradphelan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Elmish.fs
namespace Foo
open Elmish
module Elmish =
/// A function that maps a value to a value of the same type
type Update<'State> = ('State->'State)
/// A message to with instruction to
type Message<'State> = Message of (Update<'State>*Cmd<Message<'State>>)
View LVALUE.cpp
TEST(RANGE, LVALUE){
auto vector = IRange(3,5) | ToVector();
auto mvector = vector | Map([](int i){return i+1;}) | ToVector();
// Check the vector has not been moved
ASSERT_EQ(2,vector.size());
ASSERT_EQ(3,vector[0]);
ASSERT_EQ(4,vector[1]);
// Check the result has what it needs
ASSERT_EQ(2,mvector.size());
View nvector
#include "boost/type_traits/declval.hpp"
#include "boost/foreach.hpp"
#include <vector>
template <int N, typename T>
struct NVector{
typedef std::vector<typename NVector<N-1,T>::type> type;
};
template <typename T> struct NVector<1,T> {
typedef std::vector<T> type;
View SnappyLists.fs
namespace XoaDotNet
open Avalonia.Controls
open Avalonia.Media
open Avalonia.FuncUI.Types
open Avalonia.FuncUI
open Avalonia.Layout
open FSharpx.Collections
open Bogus
View SampleAvalonia.FuncUI.fs
namespace XoaDotNet
open Avalonia.Controls
open Avalonia.Media
open Avalonia.FuncUI.Types
open Avalonia.FuncUI
open Avalonia.Layout
open FSharpx.Collections
open Bogus
View lvalue pipe operator.cpp
/// Handle lvalue sequence reference.
/// This means the lifetime of the input sequence should be longer than
/// the lifetime of the output sequence
template <typename Enumerable,typename Combinator>
auto
operator|(Enumerable & enumerable, Combinator c) ->
typename boost::enable_if_c
< MW_LINQ_IS_ENUMERABLE(Enumerable) && MW_LINQ_IS_LAZY_COMBINATOR(Combinator)
, EnumerableOp
< Combinator
View heatseeker powershell
# Trigger fuzzy search
Set-PSReadlineKeyHandler `
-Chord 'Ctrl+s' `
-BriefDescription "InsertHeatseekerPathInCommandLine" `
-LongDescription "Run Heatseeker in the PWD, appending any selected paths to the current command" `
-ScriptBlock {
$choices = [IO.File]::ReadAllText($(Resolve-Path .hscache)) | hs
$ps::Insert($choices -join " ")
}
View teamcity log
[2018-02-26 13:36:16,380] INFO - jetbrains.buildServer.STARTUP - Server shutdown event received
[2018-02-26 13:36:16,382] INFO - jetbrains.buildServer.STARTUP - Current stage: TeamCity server is shutting down
[2018-02-26 13:36:16,382] INFO - jetbrains.buildServer.STARTUP - Stopping the main application
[2018-02-26 13:36:16,483] INFO - jetbrains.buildServer.STARTUP - Destroying the main servlet
[2018-02-26 13:36:16,483] INFO - MainTeamCityApplicationContext - Closing WebApplicationContext for namespace 'buildServer-servlet': startup date [Mon Feb 26 12:47:07 CET 2018]; parent: jetbrains.buildServer.maintenance.WebDispatcherApplicationContext@1dc816b
View SubjectAsPropertyHelper.cs
public class TwoWayBindingWithConversionDemo
{
public class Model : ReactiveObject
{
/// <summary>
/// The model length will be in units meters
/// </summary>
[Reactive] public double LengthInMeters { get; set;}
}
View AzureStartup.cs
using Microsoft.Azure;
using Microsoft.WindowsAzure;
using Owin;
using Weingartner.Distribution.Website.Accounts;
using Weingartner.Distribution.Website.Storage;
using Weingartner.Distribution.Website.Storage.Azure;
namespace Weingartner.Distribution.Website.Hosting.Azure
{
public class AzureStartup
You can’t perform that action at this time.