Skip to content

Instantly share code, notes, and snippets.

View rinoldsimon's full-sized avatar

Rinold Simon rinoldsimon

View GitHub Profile
@rinoldsimon
rinoldsimon / controllers.application.js
Last active April 22, 2019 05:13
pass id in route
import Ember from 'ember';
export default Ember.Controller.extend({
appName: "Ember Twiddle"
})
@rinoldsimon
rinoldsimon / controllers.application.js
Last active April 27, 2019 14:49 — forked from jelhan/controllers.application.js
access property inside computed
import Ember from 'ember';
export default Ember.Controller.extend({
appName: "ember-twiddle",
allItems: ['a', 'b'],
sortedItems: Ember.computed.sort('allItems', function(a, b) {
alert(this.get('columnList'));
}),
columnList: ["name","shortcode"],
init() {
import Ember from 'ember';
export default Ember.Component.extend({
});
@rinoldsimon
rinoldsimon / controllers.application.js
Last active April 20, 2019 06:39
checkbox example
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'checkbox example',
actions: {
setProperty() {
// toggle the property on click
this.toggleProperty("my_property");
alert("checkbox value: "+this.get('my_property')); // returns true or false based on the checked value
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
active: true,
actions: {
someAction() {}
}
});
@rinoldsimon
rinoldsimon / controllers.application.js
Last active March 21, 2019 06:54
changing service property and accessing it globally
import Ember from 'ember';
export default Ember.Controller.extend({
name1: null,
name2: null,
init() {
this._super(...arguments);
// print initial value
this.set('name1', (this.get('serviceName').name)); // hello
// change value of name property in service
import Ember from 'ember';
import { validator, buildValidations } from 'ember-cp-validations';
const validations = buildValidations({
name2: validator('presence', {
presence: true
})
});
export default Ember.Controller.extend(validations, {
appName: 'Ember Twiddle'
## nl2br Helper class for Ember > 2.0
import Ember from 'ember';
const {
Helper: { helper },
String: { htmlSafe }
} = Ember;
export function nl2br([text]) {

CSS Selectors Cheat Sheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
 foo: bar;
!!! 5
%html
%head
%title Example HAML
/[if IE]
%link{ :rel => "stylesheet", :href => "/css/ie.css" }
%body
#container
%header
%h1 Our Awesome HTML5 Template