Skip to content

Instantly share code, notes, and snippets.

View kavitshah8's full-sized avatar

Kavit Shah kavitshah8

  • Adobe
  • Bay Area, CA
View GitHub Profile

Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI

  • In general, replace views + controllers with components

  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController

  • Fetch data in your route, and set it on attrs on your top-level controller:

    ```js   
    //controllers/index.js
    import Ember from 'ember';
    
@kavitshah8
kavitshah8 / git-workflow.md
Last active August 29, 2015 14:21
Company Git Workflow
  git pull
  git checkout -b branch/name
  git pull -u origin branch/name

Then create a pull request.Once your pull request is reviewed and merged to the master do the following.

 git branch -d branch/name
@kavitshah8
kavitshah8 / grunt-basics.md
Last active August 29, 2015 14:22
Grunt Everyday Commands
  1. Gruntfile has four main parts

    • Wrapper Function
    • Initialization
    • Loading
    • Registration
  2. Useful commands

    • grunt --help - Available Grunt Commands
    • grunt --help | grep command_name - Looks for a specific command in the list of available commands list
  • grunt concat:foo - Running a concat task with foo configuration
@kavitshah8
kavitshah8 / terminal.md
Last active August 29, 2015 14:22
Useful Terminal Commands
  1. ls -la ~
  2. echo $PS1 // PS means prompt string 1
@kavitshah8
kavitshah8 / close.js
Last active August 29, 2015 14:23
Capturing Browser/Tab Close Event
function close () {
return 'To End the meeting correctly, please click Stay on this page and then click the Exit Button at the bottom of this page';
}
window.onbeforeunload = close;
@kavitshah8
kavitshah8 / closure.js
Last active July 19, 2016 07:42
Closures
function sum(a, b) {
function innerSum(b) {
alert(a + b);
}
return b ? innerSum(b) : innerSum;
}
@kavitshah8
kavitshah8 / callback.js
Last active August 29, 2015 14:23
Callbacks
function coordinates(x, y, callback) {
callback(x, y);
}
coordinates(10, 20, function(x, y){
console.log(x + y);
});
Promise.resolve().then(function () {
return 100;
})
.then(function() {
console.log(arguments);
});
// ---
Promise.resolve(200).then(function () {
@kavitshah8
kavitshah8 / implementation.js
Last active August 29, 2015 14:24
Callback
jQuery = {
get: function(url, callback) {
// do some XHR and get response back from the server
if (response.status === 200) {
callback(response.data);
}
}
}
@kavitshah8
kavitshah8 / mdn-prmose.js
Last active August 29, 2015 14:24
Promise Fun
// Examples you can try in the Dev tools.
// Aim for these examples to demonstrate different ways of using promises
var p = Promise.resolve().then(function(){
console.log('Promise resolve callback');
}, function(){
console.log('Promise reject callback');
});
var p = Promise.reject().then(function(){