Skip to content

Instantly share code, notes, and snippets.

View ukcoderj's full-sized avatar

Justin ukcoderj

View GitHub Profile
@ukcoderj
ukcoderj / An Over-Engineered Console to Perform a Function every x milliseconds
Created February 5, 2015 20:59
An Over-Engineered Console to Perform a Function Every x Seconds / Milliseconds
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestConsole
{
public interface IProcessor
{
@ukcoderj
ukcoderj / AngularJS Replace String Filter
Created January 7, 2015 16:21
Using AngularJS, this method takes a string bound in the UI and replaces it as required
// Usage
// {{myIntValue | number:0 | replacestringfilter:',':'.'}}
// {{myStringValue | replacestringfilter:'ABC':'DEF'}}
myApp.filter('replacestringfilter', function () {
return function (item, oldstring, newstring) {
if (!item)
return item;
var sItem = item.toString();
var find = oldstring;
var re = new RegExp(find, 'g');
@ukcoderj
ukcoderj / Print Javascript Array Of Properties As Angular Scope Assignment and Bindings
Last active August 29, 2015 14:12
Create AngularJs assigments from an array of different javascript properties (can convert from json first)
var printJavascriptArrayOfPropsAsAngularScopeAssignment = function (longArrayOfProperties, useOneTimeBindingSyntax) {
/// <summary>Takes a long list of properties, strips the names,
/// creates angular.js assignments/ bindings and outputs to console for copy+paste
///
/// - If you have an array of Json data, use angular.fromJson(jsonString) or JSON.parse(jsonString) first to get it in the right format
/// View the output in your javascript console (e.g. in Chrome)
/// Example Input -> var myProps = { myProperty1: 3, MyProperty2: 'Dave' };
/// Example Output
/// $scope.myProperty = inputData.myProperty;
/// $scope.myProperty2 = inputData.MyProperty2;