Skip to content

Instantly share code, notes, and snippets.

View efbenson's full-sized avatar

Erik Benson efbenson

  • ESP Logistics Technology
  • West Chester PA
View GitHub Profile

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@efbenson
efbenson / InternalOnly.js
Created April 22, 2015 16:06
Userscript (Tampermonkey) to change new comment on JIRA to internal only by default.
// ==UserScript==
// @name Select only Geo for Jira comments by default
// @namespace http://scripts.efbenson.info/
// @version 0.1
// @description Selects the private opton by default
// @match *geodecisions.atlassian.net/browse/*
// @include *geodecisions.atlassian.net/browse/*
// @copyright 2012+, Erik Benson
// @license MIT
// ==/UserScript==

Keybase proof

I hereby claim:

  • I am efbenson on github.
  • I am efbenson (https://keybase.io/efbenson) on keybase.
  • I have a public key whose fingerprint is DE64 CBF4 09B3 FA06 6B7C E4E4 4C3E 0220 DCC3 0320

To claim this, I am signing this object:

@efbenson
efbenson / gist:6777089
Created October 1, 2013 11:29
Stylebot Snippet to mark production sites to help when you are bouncing between prod and dev
#page-header-container:before {
background-color: red;
border: solid 3px black;
border-radius: 15px;
color: black;
content: "PRODUCTION";
display: block;
font-size: 2em;
font-weight: bold;
margin: 0 auto;
@efbenson
efbenson / gist:4259495
Created December 11, 2012 15:48
Model Binders for MongoDB ObjectIds
namespace Web.Serializers
{
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using MongoDB.Bson;
public class ObjectIdModelBinder : DefaultModelBinder
{
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
@efbenson
efbenson / gist:4259486
Created December 11, 2012 15:47
Automapper for MongoDB ObjectIds
Mapper.CreateMap<List<ObjectId>, List<string>>().ConvertUsing(o => o.Select(os => os.ToString()).ToList());
Mapper.CreateMap<List<string>, List<ObjectId>>().ConvertUsing(o => o.Select(os => ObjectId.Parse(os)).ToList());
Mapper.CreateMap<ObjectId, string>().ConvertUsing(o => o.ToString());
Mapper.CreateMap<string, ObjectId>().ConvertUsing(s => ObjectId.Parse(s));
//CODE in project
Facility.AddIndex(f => f.Locations);
LookupMetadata.AddIndex(f => new {f.TypeFullName, f.Data.DisplayText});
//CODE in library
public void AddIndex(Expression<Func<T, object>> indexKey, string indexName = null, bool isUnique = false, bool descending = false)
{
if (string.IsNullOrEmpty(indexName))
@efbenson
efbenson / gist:1142230
Created August 12, 2011 15:03
html5 boilerplate jade
!!! 5
\<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
\<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
\<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
\<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
\<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
head
meta(charset='utf-8')
title='Bobsled Team'
meta(name='description', content'')