Skip to content

Instantly share code, notes, and snippets.

View ry8806's full-sized avatar

Ryan Southgate ry8806

View GitHub Profile
@ry8806
ry8806 / index.html
Last active March 15, 2016 21:50
Multiline Text in Highcharts (SVG)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>
<script src="script.js"></script>
@ry8806
ry8806 / promise_before.js
Last active April 15, 2016 21:45
AngularJS combining promises
var theResults = [];
someAsyncWork().then(function(result){
return getFirstValue().then(function (value) {
theResults.push(value);
});
}).then(function (result) {
return getSecondValue().then(function (value) {
theResults.push(value);
});
var promise1 = getFirstValue().then(function (value) {
return value;
});
// We can just return a value without creating a promise if we don't need.
var promise2 = "A value that is instant";
var promise3 = getThirdValue().then(function (value) {
return value;
});
var promise1 = getFirstValue().then(function (value) {
return value;
});
// DON'T DO THIS
var p2 = $q.defer();
p2.resolve("A value that is instant but we're faffing around with it");
var promise2 = p2.deferred;
var promise3 = getThirdValue().then(function (value) {
using System.IO;
using Microsoft.Azure.WebJobs;
namespace WebJob1
{
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
@ry8806
ry8806 / AutofacActivator.cs
Last active May 10, 2016 09:17
WebJobs and DI
using Autofac;
using Microsoft.Azure.WebJobs.Host;
namespace WebJob1
{
public class AutofacActivator : IJobActivator
{
private readonly IContainer _container;
public AutofacActivator(IContainer container)
app.filter('textfilter', [function() {
return function (input) {
if (arguments.length > 1) {
// If we have more than one argument (insertion values have been given)
var str = input;
// Loop through the values we have been given to insert
for (var i = 1; i < arguments.length; i++) {
// Compile a new Regular expression looking for {0}, {1} etc in the input string
var reg = new RegExp("\\{" + (i-1) + "\\}");
// Perform the replace with the compiled RegEx and the value
@ry8806
ry8806 / gulpfile.js
Last active October 19, 2016 12:59
Search Box Component for ASP.NET Core (MVC) and Angular2
/// <binding BeforeBuild='beforeBuild' />
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require('gulp');
var webRoot = "./wwwroot/";
function isDefinedAndNotNull(property) {
return property !== undefined && property !== null;
};
angApp.directive("radioTrackBy", [function () {
return {
restrict: "A",
scope: {
ngModel: "=",
ngValue: "=",
@ry8806
ry8806 / form.html
Last active May 8, 2021 09:26
Elastic Email + JavaScript
<form id="subscribeForm">
<input id="email-input" type="text" />
<button type="submit">Submit</button>
</form>