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 / uuid.md
Last active Aug 29, 2015
关于 UUID 的知识
View uuid.md

UUID(版本4)的形式为:

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

其中,x 是任意十六进制字符,y8,9,a,b,A,B 其中之一。它的正则表 达式可以写作:

/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/
@nightire
nightire / application.route.js
Last active Nov 1, 2015
The simplest todo-ish app in recently Ember
View application.route.js
import Ember from 'ember';
let { RSVP, A, Object } = Ember;
export default Ember.Route.extend({
model() {
return RSVP.resolve(A([
Object.create({ name: 'Channel 1' }),
Object.create({ name: 'Channel 2' })
]))
},
@nightire
nightire / application.controller.js
Last active Nov 1, 2015
Same demo with explicitly mutable property declaration
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
addChannel(name) {
this.get('model').addObject({ name })
}
}
});
@nightire
nightire / application.controller.js
Created Nov 6, 2015
原生选择控件在 Ember 2.x 里的基础用法
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
choices: Ember.A([
'苹果', '橘子', '香蕉', '梨子'
]),
actions: {
selectChanged(value) {
alert(value)
@nightire
nightire / application.controller.js
Created Nov 6, 2015
Unable to use mockjax with ember data
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@nightire
nightire / application.controller.js
Last active Nov 28, 2015
component with targetObject?
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
notify(event) {
console.log(event)
}
}
});
@nightire
nightire / application.controller.js
Last active Nov 28, 2015
variable length of data passing down to a component
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
calendarActions: Ember.inject.service('calendar-actions'),
actions: {
bubbleAction(event) {
console.log(`actions in controller...`, event);
// this.send('anotherAction', 'Hello');
return true;
@nightire
nightire / application.controller.js
Last active Nov 30, 2015
Multiple mixins override multiple same methods
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});