Skip to content

Instantly share code, notes, and snippets.

View ankushdharkar's full-sized avatar

Ankush Dharkar ankushdharkar

View GitHub Profile
import { action } from '@ember/object';
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
constructor() {
this.super(...arguments);
alert('HU!');
}
@ankushdharkar
ankushdharkar / controllers.application\.js
Last active February 17, 2022 01:13
Options Selected Default
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@tracked isSelected=true;
}
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class extends Component {
@action
inputValueChanged(e) {
const val = "POKEMON = " + e.target.value;
@ankushdharkar
ankushdharkar / README.md
Last active April 3, 2022 15:25
zsh configuration

.zshrc file

Don't forget to source it after changes

projectDirectory="<path-to-all-your-software-projects>";

alias openZshrc="code ~/.zshrc";
alias goFolderSoftwareProjects="cd $projectDirectory && ls -lh";
alias goFolderRealDevSquad="cd $projectDirectory/Real-Dev-Squad && ls -lh";
@ankushdharkar
ankushdharkar / Google (Firestore) credentials service account keys importing
Created January 15, 2021 18:54
How to import the service account keys config into your code, especially from environment variables
const admin = require('firebase-admin');
const firestoreConfig = process.env.FIRESTORE_CONFIG; // **String** of firestore service account keys https://cloud.google.com/iam/docs/creating-managing-service-account-keys
// `{
// "type": "service_account",
// "project_id": "project-id",
// "private_key_id": "key-id",
// "private_key": "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n",
// "client_email": "service-account-email",
// "client_id": "client-id",
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
formData = {
email: 'abc@gmail.com',
phone: 1231231
}
inputList = [
{
@ankushdharkar
ankushdharkar / controllers.application\.js
Last active September 21, 2020 18:14
Using Array in Ember Octane
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { A } from '@ember/array';
import { set } from '@ember/object';
class Age {
@tracked value;
@ankushdharkar
ankushdharkar / components.new-foo-comp.js
Last active July 25, 2018 06:04
this Object ref in Util function
import funcSpecial from '../utils/my-special-func';
import Ember from 'ember';
export default Ember.Component.extend({
foo: 123,
newFoo: funcSpecial(this, 'foo')
});
@ankushdharkar
ankushdharkar / computed-task.js
Last active July 20, 2018 23:26
Using tasks that perform on property update
// Mixin
import { task } from 'ember-concurrency';
import Mixin from '@ember/object/mixin';
export default Mixin.create({
computedTask(keyToWatch, genFunc) {
// Maybe check if this wasn't previously set up
// Ready the task
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
circleClicked() {
alert('Circle was clicked!');
return false;
}
}
});