Skip to content

Instantly share code, notes, and snippets.

View mattbrailsford's full-sized avatar

Matt Brailsford mattbrailsford

View GitHub Profile
$rsa = new Crypt_RSA();
$rsa->loadKey($public_key);
$encrypted = $rsa->encrypt($text);
public class ListingPageController : RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
// Do stuff here
return CurrentTemplate(new ListingViewModel(model)
{
CurrentListing = listing
});
using System.Web.Mvc;
using TheOutfield.Website.XsltExtensions;
namespace TheOutfield.Website.Controllers
{
public class DisqusController : Controller
{
[HttpGet]
[OutputCache(Duration = 300, VaryByParam = "threadId")]
public JsonResult GetCommentCount(int threadId)
@mattbrailsford
mattbrailsford / PublishedContentExtensions.cs
Last active August 29, 2015 13:57
A JQuery like API for Umbraco
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.WebPages;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Our.Umbraco.Api.Jq
{
public static class PublishedContentExtensions
@mattbrailsford
mattbrailsford / HelloWorld.js
Created March 25, 2014 18:27
A simple hello world Espruino gist
print("hello world from gist!");
@mattbrailsford
mattbrailsford / Bootstrap.cs
Created August 7, 2014 12:50
Indexing JSON values in Umbraco
public class Bootstrapper : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"]
.GatheringNodeData += (sender, e) =>
{
// Extract JSON properties
public static class StringExtensions
{
public static bool DetectIsJson(this string input)
{
input = input.Trim();
if (input.StartsWith("{") && input.EndsWith("}"))
return true;
if (input.StartsWith("["))
return input.EndsWith("]");
else
Welcome to Node-RED
===================
C:\Users\User\Documents\GitHub\NodeREDWebkit\src\NodeREDWebkit.App\node_modules\node-red\red\server…:69
14 Aug 08:36:08 - [red] Version: 0.8.1 util.js:611
14 Aug 08:36:08 - [red] Loading palette nodes util.js:611
js-bson: Failed to load c++ bson extension, using pure JS version
Warning: Native modules not compiled. XOR performance will be degraded.
Warning: Native modules not compiled. UTF-8 validation disabled.
Cannot load StringPrep-0.1.0 bindings. You may need to `npm install node-stringprep` c:\Users\User\Documents\GitHub\NodeREDWebkit\src\NodeREDWebkit.App\node_modules\simple-xmpp\node_mo…:36
#include "L9110.h"
#include "spark_wiring.h"
///////////////////////////////////////////
/// Public
//////////////////////////////////////////
/// Constructor
L9110::L9110() { }