Skip to content

Instantly share code, notes, and snippets.

@Joelkang
Joelkang / Dockerfile
Last active March 19, 2024 03:31
Dockerfile to create a container with the right deps to quantize models with MLC for CUDA 12.1
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 as deps
SHELL ["/bin/bash", "--login", "-c"]
# Step 1. Set up Ubuntu
RUN apt update && apt install --yes wget ssh git git-lfs vim
# NOTE: libcuda.so.1 doesn't exist in NVIDIA's base image, link the stub file to work around
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so.1
WORKDIR /root

Introduction

Many people are confused by the {{mut}} helper because it seems very magical. This gist aims to help you construct a mental model for understanding what is going on when you use it.

History

Prior to the introduction of {{mut}}, form elements were two-way bound by default. That is, given this component:

import Ember from 'ember';
export default Ember.Component.extend({

Introduction

Controllers are a little big of a black sheep in Ember. At one point people thought controllers were going away, and were told not to use them. Since it's unclear what the state of routeable components are, controllers are very much here to stay until that story unfolds. As such, this gist aims to provide some clarity on what controllers are (or should be), and how to use them.

Are Controllers are deprecated?

Nope. ObjectController and ArrayController are deprecated, but the Controller class exists and supersedes them. Controllers sit between your routes and the top level templates used to render those routes. While a route may be the place that obtains your data, a controller is the abstraction on top of that data that you can use to massage the data for presentational purposes. My favorite example of a controller is to combine two lists into a single array for loopin

@Joelkang
Joelkang / intermediate-ember-routing.md
Last active June 5, 2018 00:05
Intermediate Ember Routing

#Introduction

This gist walks through some best-practices for intermediate routing architecture, augmenting the information already covered in the guides. It will cover:

  • Nested routes and outlet placement
  • Resuing templates for multiple routes
  • Normalising routes

By the end of the gist, you should be able to make informed decisions about how to structure your routes and their templates. This guide is not meant to provide all the answers, but to help you understand the tools available to you for architecting your app.

@Joelkang
Joelkang / application.controller.js
Last active March 21, 2016 21:32
Dragging an element in a component
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@Joelkang
Joelkang / application.controller.js
Last active February 12, 2016 15:10
Sort by nested property
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
list: Ember.A([
{
level1: {
level2: "one",
l2Array: [1, 4, 5]
},