Skip to content

Instantly share code, notes, and snippets.

View rahulcs's full-sized avatar
🌳

Rahul Chanila rahulcs

🌳
View GitHub Profile
@rahulcs
rahulcs / vue-dialog-focus-trap.md
Last active June 16, 2021 01:20
Vue Dialog Focus trap

Requirements

  • export as vue component
  • active or similar boolean prop to enable/disable trap
  • focus first focusable element within children of components
  • traps user focus within the element.
  • optional: prop to specify element to focus on
  • optional: prop to specify element focus on when disabled

Options

@rahulcs
rahulcs / status-color-mapper-enum.ts
Last active April 9, 2018 02:03
playing with adding types with typescript
type Status = 'Unapproved' | 'Rejected' | 'Approved';
enum statusEnum {
Unapproved = 'grey',
Rejected = 'red',
Approved = 'green'
}
interface Arr {
id: number;
@rahulcs
rahulcs / site.reports.report-type.detail.index.js
Created February 24, 2015 08:02
nested index route code example
export default Ember.Route.extend({
renderTemplate: function() {
this.render('site.reports.report-type.detail.index', { // the template to render
into: 'site.reports.report-type', // the template to render into
controller: 'site.reports.report-type.detail'// the controller to use for the template
});
}
});
@rahulcs
rahulcs / functions
Created March 20, 2014 11:06
Function Invocation and `this`
1. When a function is invoked by '()' , `this` is set to the window global object.
2. Invocation as a method of an object will set `this` to the object itself.
3. Invocation as a contstructor referenced with the 'new' keyword, the object is passed as 'this' to the constructor and any absence of an explicit return value with always return the new object created as the constructor.
4. Invocation via call/apply passes an object as function parameter & that object will be set to `this`.