Skip to content

Instantly share code, notes, and snippets.

View chrisnicola's full-sized avatar

Chris Nicola chrisnicola

View GitHub Profile
@chrisnicola
chrisnicola / angular.d.ts
Created September 14, 2016 19:51
Fixed Angular type definition
// Type definitions for Angular JS 1.5
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
declare var angular: angular.IAngularStatic;
// Support for painless dependency injection
@chrisnicola
chrisnicola / type_compatibility.ts
Created October 27, 2016 21:56
Type inference limitations for Typescript
class TypeOne {
public one
private two
private three
}
class TypeTwo {
public one
}
export function parseName(path) {
const name = path.toLowerCase()
// Remove starting ./
.replace(/^\.\//, '')
// Parameters
.replace(/\/_(\w+)(\/|\.vue$)/, '/:$1/')
// Remove file extension and 'index'
.replace(/(index)?\.vue$/, '')
// Remove trailing '/'
.replace(/\/$/, '');