Skip to content

Instantly share code, notes, and snippets.

View tdbrian's full-sized avatar

Thomas Brian tdbrian

  • Gulf Breeze, FL
View GitHub Profile
@tdbrian
tdbrian / Angular Data Handler
Created October 4, 2018 13:31
Angular data handler for async data calls.
import { BehaviorSubject, Observable } from 'rxjs';
export class DataHandler<T> {
value: T;
value$: BehaviorSubject<T>;
isLoading = false;
hasError = false;
error: any = null;
errorIsString = false;
successful = false;
@tdbrian
tdbrian / Hubs.tt
Last active December 16, 2015 17:43
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.2.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@tdbrian
tdbrian / Hubs.tt
Last active August 29, 2015 14:24 — forked from robfe/Hubs.tt
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.2.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@tdbrian
tdbrian / Git Certain File Merge
Created September 2, 2013 01:48
Git merge certain files from another branch
$ git branch
* master
twitter_integration
$ git checkout twitter_integration app/models/avatar.rb db/migrate/20090223104419_create_avatars.rb test/unit/models/avatar_test.rb test/functional/models/avatar_test.rb
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: app/models/avatar.rb
@tdbrian
tdbrian / MongoDB: Converts Fields from Number to String
Created May 14, 2013 03:12
Converts all MongoDB fields in a collection from number to string
db.portals.find( { 'pid' : { $type : 1 } } ).forEach( function (x) {
x.pid = x.pid += '';
db.portals.save(x);
});