Skip to content

Instantly share code, notes, and snippets.

View ratbeard's full-sized avatar

Mike Frawley ratbeard

View GitHub Profile
if (items.length > 1) {
return false
}
const item = items[0]
if ('attachableIcon' in item) {
return item.actions.includes('update')
} else {
return item.actions.includes('update')
}
interface ErrorResponse {
errorMessage: string;
redirectUrl?: string;
}
interface SessionResponse {
username: string;
email: string;
}
@ratbeard
ratbeard / gist:78f3fdebd2c2b107b2791475cb3acf45
Created April 12, 2018 16:44
RFC 89: Self closing tag placement when attributes broken across lines
# Option 1:
<input
id="adminName"
placeholder="Library Name"
required
type="text"
value={this.state.adminName}
onChange={this.setAdminName} />
@import 'Variables';
.wrapper {
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s linear;
}
.wrapper.is-large {
min-width: 50px;
// 1 - rename type
import { IBreadcrumb, BreadcrumbFrontend, BreadcrumbData, SomeOtherNamingConvention } from 'types'
export class Breadcrumb extends Component {}
// 2 - rename component. yuck
import { Breadcrumb } from 'types'
export class BreadcrumbComponent extends Component {}
/* http://meyerweb.com/eric/tools/css/reset/ */
html, body ol, ul, li {
margin: 0;
padding: 0;
}
ol, ul {
list-style: none;
}
// ...
if (!quiz.activityResponse.quiz.id) {
gradeDatQuiz()
this.Activity.createQuestionResponses( quiz, quiz.activityResponse )
this.saveQuizResponse( quiz )
}
this.setupUI( quiz )
}
import { SearchInputModule } from './../search-input/search-input.module';
import { GetRecordsServiceMock } from './../get-records.service.mock';
import { AppConfigServiceMock } from './../app-config-service/app-config-service.mock';
import { AppConfigService } from './../app-config-service/app-config.service';
import { MaterialModule } from '@angular/material';
import { SorterComponent } from './../sorter/sorter.component';
import { ScormDisclaimerComponent } from './../scorm-disclaimer/scorm-disclaimer.component';
import { GetRecordsService } from './../get-records.service';
import { FilterBySystemComponent } from './../filter-by-system/filter-by-system.component';
import { LearningContentTableComponent } from './../learning-content-table/learning-content-table.component';
<app-report-title-bar [title]="report.adminName" type="Completion">
<app-report-option-panel [report]="report">
</app-report-option-panel>
</app-report-title-bar>
=>
<report-title-bar [title]="report.adminName" type="Completion">
<report-option-panel [report]="report">
@ratbeard
ratbeard / async.js
Last active January 29, 2018 22:44
delete() {
this.sms
.confirm({text: 'Are you sure?'})
.filter(isConfirmed => isConfirmed)
.subscribe(this.doDelete);
}
doDelete = ( confirmed ) => {
if (confirmed) {
this.reportService.delete(+this.report.playbookID).subscribe(data => {