Skip to content

Instantly share code, notes, and snippets.

View joeriks's full-sized avatar
💭
I may be slow to respond.

Jonas Eriksson joeriks

💭
I may be slow to respond.
View GitHub Profile
@pgregorynz
pgregorynz / previewbadge.xml
Last active August 29, 2015 14:08
A better Umbraco Preview Mode Indicator
<!--
replace the previewBadge element in the umbracosettings.config
This will give you a green fixed banner across the bottom of the screen.
It adds 50px to the bottom of page to ensure the banner
doesnt mess with your design. It also has a high z-index so it will work properly in most situations.
-->
<PreviewBadge><![CDATA[
<div style="width:100%; height:50px;">
<a id="umbracoPreviewBadge" style="position: fixed; z-index:1000; width:100%; background: #00cc00; bottom:0;left:0;padding:15px" href="{0}/endPreview.aspx?redir={2}">
fun main(args: Array<String>) {
val httpClient = HttpClient()
httpClient.get("http://site.com") {
println(body)
}
}
@ToJans
ToJans / InventoryItems.hs
Last active December 21, 2024 10:20
Haskell implementation of Greg Young's CQRS sample: https://github.com/gregoryyoung/m-r Love the sheer elegance of Haskell; no need for all that infrastructure crap
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@liammclennan
liammclennan / gist:7352790
Last active December 27, 2015 16:09
string calculator
let lToS (l:char list) = System.String.Concat(Array.ofList(l))
let sumString =
let parse (l:string) =
let guessDelimeter (l:string) =
match Seq.toList l with
| '/'::'/'::c::'\n'::_ -> c
| _ -> Seq.find (fun i -> i = ',' || i = '\n') l
let valuePart = (fun (s:string) ->
match Seq.toList s with
@leekelleher
leekelleher / MyApplication.cs
Last active December 19, 2015 13:59
Example of Umbraco 6.1's IContentFinder
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
namespace Our.Umbraco
{
public class MyApplication : ApplicationEventHandler
{
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
@robfe
robfe / Hubs.tt
Last active March 18, 2020 16:17
T4 template that creates Typescript type definitions for all your Signalr hubs. If you have C# interface named "I<hubName>Client", a TS interface will be generated for the hub's client too.If you turn on XML documentation in your build, XMLDoc comments will be picked up.Licensed with http://www.apache.org/licenses/LICENSE-2.0
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.2.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@leekelleher
leekelleher / 1-umbraco-scripting.md
Last active December 10, 2015 12:38
Umbraco console/scripting concept

Umbraco scripting, with console/CLI

Enabling a scripting mechanism for Umbraco, using a console (command line interface) to execute the scripts/queries.

So far, the examples are using C#, however a suitable scripting language should be used. Currently JavaScript is the favourite, followed by Lua and Python.

@ardalis
ardalis / Program.cs
Last active September 20, 2021 09:00
A StructureMap Example using a Console Application
using System;
using System.Linq;
using StructureMap;
namespace ConsoleApplication1
{
/// <summary>
/// See http://stackoverflow.com/questions/6777671/setting-up-structure-map-in-a-c-sharp-console-application
/// Updated for SM 4: http://ardalis.com/using-structuremap-4-in-a-console-app
/// </summary>
@joeriks
joeriks / Default.cshtml
Created August 12, 2012 18:47
Small SignalR + Managedesent sample, tested in WebMatrix (using App_Data), demonstrating using SignalR for "common" client-server calls which are usually done with jquery ajax+url's
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Site's Title</title>
<script src="/Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.signalR-0.5.2.min.js" type="text/javascript"></script>
<script src="/SignalR/hubs" type="text/javascript"></script>
@leekelleher
leekelleher / umbraco-package-ideas.md
Last active June 9, 2020 09:36
Umbraco Package Ideas