Skip to content

Instantly share code, notes, and snippets.

View DaveMBush's full-sized avatar

Dave Bush DaveMBush

  • Cheshire, CT
View GitHub Profile
@DaveMBush
DaveMBush / b64ToFile.ts
Last active July 1, 2017 16:29
Image Blog Post
b64toFile(dataURI): File {
// convert the data URL to a byte string
const byteString = atob(dataURI.split(',')[1]);
// pull out the mime type from the data URL
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
// Convert to byte array
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
@DaveMBush
DaveMBush / app-routes1.module.ts
Last active July 15, 2017 19:16
Angular Routing
export const routes: Routes = [];
@NgModule({})
export class AppRoutesModule {}
@DaveMBush
DaveMBush / package.json
Last active August 1, 2017 12:54
Functional TypeScript
{
...
"scripts": {
"lint": "ng lint --type-check",
...
},
"pre-commit": [
"lint"
],
...
@DaveMBush
DaveMBush / buttonClick.js
Last active August 5, 2017 15:59
Explaining Observables
Observable.fromEvent(this.myButton,'click').subscribe((event) =>
   /* do something in response to the click here */
);