Skip to content

Instantly share code, notes, and snippets.

View nightire's full-sized avatar
Looking for new opportunities

余凡 nightire

Looking for new opportunities
View GitHub Profile
@nightire
nightire / 解决 Git 在 windows 下中文乱码的问题.md
Last active April 24, 2024 16:19
解决 Git 在 windows 下中文乱码的问题

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

原因

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

解决方案

  1. 安装
@nightire
nightire / debug_ember_app_in_vscode.md
Created May 17, 2018 11:21
How to debug an ember application with VS Code

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

Web 中文字体应用指南

在 Web 上应用字体是一项基本技术,同时也是一门艺术。对于英文字体来说可选择的范围实在是太广泛了,合理的使用它们将会为你的网站增色不少。关于英文字体的使用和搭配技巧,在这里不做赘述,只推荐一套非常好的视频:Fundamentals of Design by CodeSchool

而真正的挑战在于中文字体,由于中文字体组成的特殊性导致其体积过于庞大,除了操作系统内置的字体之外,我们很难在网站上应用其他的字体。在可选性很差的前提之下,如何正确的使用中文字体呢?

首先,以下的字体声明都是很糟糕的,切忌使用:

font-family: "宋体";
@nightire
nightire / .vimrc
Last active May 25, 2022 03:14
Vim 基础配置
set nocompatible " use vim defaults
set t_RV= " http://bugs.debian.org/608242
" set runtimepath=$VIMRUNTIME " turn off user scripts, https://github.com/igrigorik/vimgolf/issues/129
syntax on " turn syntax highlighting on by default
filetype on " detect type of file
filetype indent on " load indent file for specific file type
set nobackup " do not keep a backup file
set novisualbell " turn off visual bell
@nightire
nightire / Changes in Rails 4_1.md
Last active May 11, 2022 04:50
拥抱 Rails 4 —— 详述 Rails 4 的新变化

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
@nightire
nightire / component.hbs
Created September 5, 2021 03:31
Example
{{#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]"}}
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: {
import Component from '@ember/component';
export default class extends Component {
}
@nightire
nightire / components.tooltip\.js
Last active May 23, 2020 14:41
tooltip-modifier
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();
}
@nightire
nightire / controllers.application\.js
Last active May 23, 2020 13:05
Recreate vs Rerender
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 },
];