Skip to content

Instantly share code, notes, and snippets.

@digitaljhelms
digitaljhelms / gist:4287848
Last active April 23, 2024 21:43
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@DanDiplo
DanDiplo / JS-LINQ.js
Last active April 23, 2024 11:03
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@jesslilly
jesslilly / ProductControl.cs
Last active August 11, 2023 17:09
How would you refactor this code?
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace MyApplication.Web.Controllers
{
public class ProductControl : Controller
{
@Voles
Voles / datefilter.js
Created April 25, 2013 12:41
AngularJS daterange filter
RB.filter('daterange', function ()
{
return function(conversations, start_date, end_date)
{
var result = [];
// date filters
var start_date = (start_date && !isNaN(Date.parse(start_date))) ? Date.parse(start_date) : 0;
var end_date = (end_date && !isNaN(Date.parse(end_date))) ? Date.parse(end_date) : new Date().getTime();
@basti1302
basti1302 / parameterizable.spec.coffee
Last active March 1, 2018 13:17
An example of a parameterized test suite using the Jasmine BDD framework for JavaScript. This example is in CoffeeScript.
describe "The suit", ->
beforeEach ->
console.log('non-parameterized#beforeEach')
afterEach ->
console.log('non-parameterized#afterEach')
it "should execute specs in the non-parameterized part", ->
console.log('spec in non-parameterized')
@davisford
davisford / app.jade
Created November 20, 2012 18:54
Flexible Angular Routing + Twitter Bootstrap - composite Views
extends layout
block content
// navbar
div.navbar.navbar-fixed(ng-controller="NavCtrl")
div.navbar-inner
div.container
a.btn.btn-navbar(data-toggle="collapse", data-target=".nav-collapse")
span.icon-bar
a.brand(href="home")
@jesslilly
jesslilly / groupBy.js
Last active January 4, 2016 03:58
Function to group an array of x,y data. Useful for charting. Requires underscore.js.
/**
* @method
* @public
* @description Take an array of objects and convert to an array of pairs whose
* xCol are grouped and yCol values are aggregated somehow. If
* grouping by day or month, dates must be in ZULU format strings!
* Original implementation returned an object with keys = xCol and
* values = yCol. It worked great but js maps(objects) cannot be
* sorted!
* @param {array}
@jesslilly
jesslilly / logaxParserSpec.js
Created January 14, 2014 13:48
Parameterized jasmine test for your logax parser. https://github.com/jesslilly/logax. This is a really good idea to make sure that minor changes to your parser don't break your JSON output. Thanks to https://gist.github.com/basti1302/5051200 for the parameterized test gist. This test is in javascript, not coffeescript. This is a template. You wi…
var fs = require('fs');
var exec = require('child_process').exec, child;
// Inputs
var inputDir = './developer/test/unit/data/input/';
var expectedDir = './developer/test/unit/data/expected/';
var outputDir = './developer/test/unit/data/output/';
var parserA = './server/load-it/logax-a-parser.js';
var parserB = './server/load-it/logax-b-parser.js';
var inputFiles = new Array(3);
@rudyryk
rudyryk / gist:2894223
Created June 8, 2012 07:30
Confirmation dialog for Twitter Bootstrap
<div class="modal hide fade" id="confirm-dialog">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Confirm</h3>
</div>
<div class="modal-body">
&nbsp;
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger">Ok</a>
function foo() {
var er = new Error('foo() has been removed in favor of bar(). Please update your java scripts codes.')
Error.captureStackTrace(er, foo)
throw er
}
function bar() {
console.log('ok')
}