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
fun main(args: Array<String>) {
val httpClient = HttpClient()
httpClient.get("http://site.com") {
println(body)
}
}
@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}">
@ToJans
ToJans / Index.spark.html
Created March 23, 2011 01:53
let's hope I manage to get this working as well both online and offline:-)
<content name="script">
<script type="text/coffeescript">
$().ready ->
$("*[data-uri]").each (el) ->
rendertemplate = Tempo.prepare(el);
uri = el.attribute "data-uri"
refresh = el.attribute "data-refresh"
$.retrieveJSON uri , {}, (data) ->
rendertemplate.render data
@nanto
nanto / router.js
Created July 4, 2012 16:51
Router: a router that can be combined with jquery.pjax.js
// Router: a router that can be combined with jquery.pjax.js [1]
//
// [1] https://github.com/defunkt/jquery-pjax
//
// This file is in the public domain.
//
//
// var router = new Router();
// $(document).on('pjax:end', function () { router.dispatch(location); });
// $(function () { router.dispatch(location); });
@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 / 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.

@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)
@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
@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 / umbraco-package-ideas.md
Last active June 9, 2020 09:36
Umbraco Package Ideas