Skip to content

Instantly share code, notes, and snippets.

@iamdtang
iamdtang / gist:be8b4cc9558b3b6ab6cbef23150debe2
Created November 29, 2017 00:44
get bearer token from Twitter REST API for application-only authentication
require('dotenv').config();
const request = require('request');
const credentials = `${process.env.CONSUMER_KEY}:${process.env.CONSUMER_SECRET}`;
const credentialsBase64Encoded = new Buffer(credentials).toString('base64');
request({
url: 'https://api.twitter.com/oauth2/token',
method:'POST',
headers: {
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class extends Component {
@tracked value = this.args.value;
@action
setLocalValue(element, [value]) {
if (this.value !== value) this.value = value;
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action, computed, set } from '@ember/object';
export default class ApplicationController extends Controller {
@tracked configuration = {
numbers: [1, 2, 3, 4]
};
// this doesn't work
import Component from '@ember/component';
export default Component.extend({
actions: {
handleClick() {
this.hi();
}
}
})
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default Controller.extend({
saveForm: action(function() {
console.log('hi');
})
})
import Controller from '@ember/controller';
import EmberObject from '@ember/object';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
formData = EmberObject.create();
}
import Controller from '@ember/controller';
class UserCollection {
constructor(users) {
this.users = users;
}
[Symbol.iterator]() {
let i = 0;
let { users } = this;
import Component from '@glimmer/component';
import Sort from '../state-object/sort';
export default class extends Component {
sorter = new Sort()
get sorted() {
const { data } = this.args;
const { sorter } = this;
sorter.data = data;
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked isChecked = true;
@action
handleCheck(event) {
this.isChecked = event.target.checked;
@iamdtang
iamdtang / rock-and-roll-ember-interview-questions.md
Last active February 7, 2021 08:17 — forked from balinterdi/rock-and-roll-ember-interview-questions.md
The Rock & Roll with Ember band – Interview questions
  1. Could you introduce yourself in a few sentences?

Hello! My name is David Tang. I've been a web developer for 12 years and working with Ember for about 6 years. The technologies I have primarily focussed on in my career have been Ember and Laravel. This year I published my book Pro Ember Data with Apress. Currently I work at a startup called AuditBoard, where we do use Ember! I also teach web development courses part-time at the University of Southern California (USC) for the Information Technology Program (ITP), bringing practical and modern technologies to the classroom.

  1. Which part of the world you are from?

Los Angeles, CA

  1. When and how did your Ember journey begin? How did you learn about the framework?