Skip to content

Instantly share code, notes, and snippets.

View httpJunkie's full-sized avatar
🏠
Working from home

Eric Bishard httpJunkie

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function write (message) {
document.getElementById('message').innerHTML += message + '<br/>';
}
function calculateCircumference(diameter){
@httpJunkie
httpJunkie / IMessageBoardRepository
Last active August 29, 2015 14:16
Update Topic in Web API with Repository
bool EditTopic(int id, Search newSearch);
@httpJunkie
httpJunkie / FavoritesController.cs
Last active August 29, 2015 14:16
CRUD for Favorites
namespace MyProject.Controllers.api
{
public class FavoritesController : ApiController
{
private IFavoritesRepository _favRepo;
public FavoritesController(IFavoritesRepository favRepo)
{
_favRepo = favRepo;
}
@httpJunkie
httpJunkie / filterByteFormat.js
Created November 30, 2015 04:00
Angular filter for formatting bytes
app.filter('bytes', function(){
return function(bytes, precision){
if (typeof bytes !== 'number') {
bytes = parseFloat(bytes);
}
if (bytes === 0) {
return '0 B';
} else if (isNaN(bytes) || !isFinite(bytes)) {
return '-';
@httpJunkie
httpJunkie / ProgrammingPatternsJsVsCsharp.md
Last active June 21, 2018 21:29
Programming Patterns in JavaScript Vs C#
@httpJunkie
httpJunkie / FlexboxLayout.md
Last active February 1, 2016 03:04
Emmet Snippets for Flexbox layout

Flexbox Layout Snippets for Emmet (docs.emmet.io)

FlexBox 50/50 columns with rows

div[layout="row"]>div[flex="50"]*2>div[layout="column"]>div[layout="row"]>div[flex="50"]*2

@httpJunkie
httpJunkie / arrayFilter.js
Created May 28, 2016 00:17
Aurelia ValueConverter - Array Filter by Text Input
export class ArrayFilterValueConverter {
toView(array, value) {
var regex = new RegExp(value, 'gi');
var matcher = (item) =>
item.utilityName.match(regex);
return array.filter(
matcher
);
}
}
@httpJunkie
httpJunkie / filter.js
Created May 28, 2016 00:30
Aurelia ValueConverter - Array Sort & Filter
export class FilterValueConverter {
toView(array, property, query) {
if (query === void 0 || query === null || query === "" || !Array.isArray(array)) {
return array;
}
let properties = (Array.isArray(property) ? property : [property]),
term = String(query).toLowerCase();
return array.filter((entry) =>
@httpJunkie
httpJunkie / genericFilter.js
Last active September 8, 2016 06:50
Aurelia ValueConverter - Array Filter by Text Input
//aurelia ValueConverter
export class GenericFilterValueConverter {
toView(array, value, cols, showResults=false) {
if (!value) { return showResults ? array : []; };
var arrayOut = array.filter(
function(arrayIn) {
for (var col in arrayIn) {
if (arrayIn.hasOwnProperty(col)) {
if (cols.indexOf(col) != -1 && arrayIn[col].toLowerCase()
@httpJunkie
httpJunkie / Fibonacci Generator
Last active February 26, 2017 09:01
Fibbonacci Generator
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FibonacciGenerator
{
internal class Program
{