Skip to content

Instantly share code, notes, and snippets.

@jessemcdowell
jessemcdowell / gist:9920871
Created Apr 1, 2014
Retrieving Navigation Parameter
View gist:9920871
module.controller('Page2Controller', ['$scope', 'navigation', function ($scope, navigation) {
$scope.navigationParameter = navigation.getNavigationData();
}]);
@jessemcdowell
jessemcdowell / gist:9920807
Created Apr 1, 2014
Triggering Navigation
View gist:9920807
module.controller('Page1Controller', ['$scope', 'navigation', function($scope, navigation) {
$scope.navigate = function (navigationParameter) {
navigation.navigate('/Page2', navigationParameter);
};
}]);
View navigation.js
'use strict';
// var module = angular.module('...', []);
module.service('navigation', function($location) {
var storage = null;
return {
navigate: function(path, data) {
storage = {
path: path,
View RandomOrderQueue.cs
using System;
using System.Collections.Generic;
namespace Jesse.LanguageClassHelper
{
/// <summary>
/// A queue that returns items in random order
/// </summary>
public class RandomOrderQueue<T>
{
View gist:950058
int JessesAverage(int a, int b)
{
return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
}
View gist:949422
int LinqAverage(int a, int b)
{
int[] inputArray = new int[] { a, b };
return (int)inputArray.Average();
}
@jessemcdowell
jessemcdowell / gist:949410
Created Apr 30, 2011
TestAverageMethod()
View gist:949410
void TestAverageMethod(Func<int, int, int> method)
{
string methodName = method.Method.Name;
List<string> failureText = new List<string>();
int passCount = 0;
int testCount = 0;
Action<int, int, int> test = (a, b, expected) =>
{
View gist:924508
int ConversionAverage(int a, int b)
{
return (Int32)(((Int64)a + (Int64)b) / 2);
}
View gist:924497
int SimpleAverage(int a, int b)
{
return (a + b) / 2;
}
View gist:924495
int SystemMathAverage(int a, int b)
{
return System.Math.Average(a, b);
}
You can’t perform that action at this time.