Skip to content

Instantly share code, notes, and snippets.

Avatar
😄
I may be slow to respond.

Albert Yu nightire

😄
I may be slow to respond.
View GitHub Profile
@nightire
nightire / 解决 Git 在 windows 下中文乱码的问题.md
Last active Oct 1, 2021
解决 Git 在 windows 下中文乱码的问题
View 解决 Git 在 windows 下中文乱码的问题.md

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
View component.hbs
{{#if @searchKeyword}}
<div class="p-4 text-gray-600">
{{~t "tasks.searching-on" keyword=@searchKeyword~}}
</div>
{{/if}}
<div
class="divide-gray-200 divide-y"
role="list"
{{navigatable "[role=listitem]"}}
View adapters.application.js
import { Promise, defer } from 'rsvp';
import { get } from '@ember/object';
// a mock API response used below
const MOCK_PAYLOAD = {
person: {
id: '1',
name: 'Chris',
age: 33,
father: {
@nightire
nightire / debug_ember_app_in_vscode.md
Created May 17, 2018
How to debug an ember application with VS Code
View debug_ember_app_in_vscode.md

Step 1: Launch Google Chrome with Remote Debugging support

  • windows: <path to chrome>/chrome.exe --remote-debugging-port=9222
  • macOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  • linux: google-chrome --remote-debugging-port=9222

Step 2: Install "Debugger for Chrome" extension

Step 3: Setup your application

View components.accordion.content\.js
import Component from '@ember/component';
export default class extends Component {
}
View components.tooltip\.js
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@tracked container;
constructor(owner, args) {
super(owner, args);
this.container = this.createContainerElement();
}
View controllers.application\.js
import Controller from '@ember/controller';
import { action, set } from '@ember/object';
import { tracked } from 'tracked-built-ins';
export default class ApplicationController extends Controller {
@tracked items = [
{ id: 1, value: 1 },
{ id: 2, value: 2 },
{ id: 3, value: 3 },
];
@nightire
nightire / components.change-password\.js
Last active May 22, 2020
Octane way of changing password
View components.change-password\.js
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
const MESSAGES = {
staled: 'The old password and new password are the same. The password was not changed.',
invalid: 'The new password and confirm password must be the same value. The password was not changed.'
};
export default class extends Component {
View components.tagged-input\.js
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@tracked tags = ['programming', 'rails'];
@tracked tag = '';
@action addTag(event) {
View components.classic-search\.js
import Component from '@ember/component';
import { computed } from '@ember/object';
export default class extends Component {
query = '';
@computed('query') get _options() {
if (this.query) {
return this.options.filter((option) => {
return option.value.toLowerCase().lastIndexOf(this.query, 0) === 0;