Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property. -- The Ember Guides
The Ember Object Model is the corner stone of Ember, and at the heart of the Object Model are computed properties.
The guides do a fine job giving need to know information on how to create and use computed properties and what to expect from the cacheing system they provide. However, I feel so much of the beauty that computed properties provide is lost in terse (but wonderful) documentation.
module BulkUpdatable | |
def bulk_update(objects, attribute) | |
return unless objects.any? | |
query = build_query_for(objects, attribute) | |
connection.execute(query) | |
end | |
private |
<script> | |
// A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers. | |
// Note that: | |
// - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020. | |
// - In Edge, this may call `resolve()` even if copying failed. | |
// - In Safari, this may fail if there is nothing selected on the page. | |
// See https://github.com/lgarron/clipboard-polyfill for a more robust solution. | |
// | |
// License for this Gist: public domain / Unlicense | |
function writeText(str) { |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
require "active_record" | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Migration.class_eval do | |
create_table(:records) do |t| | |
t.string :column | |
end | |
end | |
data = 50_000.times.map { |i| Hash[column: "Column #{i}"] } |
We are planning on building a Node.js service. Here's our evaluation of the current ORM landscape:
Last updated: May 2 2016
An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.
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.
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({
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.