Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
(e.g. app/models/concerns/, app/models/products/)
| "use client"; | |
| import { createContext, useCallback, useContext } from "react"; | |
| const AccordionContext = createContext({ | |
| value: [], | |
| onValueChange: () => {}, | |
| }); | |
| const ItemContext = createContext({ |
| # frozen_string_literal: true | |
| class AssociationLoader < GraphQL::Batch::Loader | |
| attr_reader :klass, :association | |
| def initialize(klass, association) | |
| raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol) | |
| raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base | |
| raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association) | |
| @klass = klass |
| (function addXhrProgressEvent($) { | |
| var originalXhr = $.ajaxSettings.xhr; | |
| $.ajaxSetup({ | |
| progress: function() { console.log("standard progress callback"); }, | |
| xhr: function() { | |
| var req = originalXhr(), that = this; | |
| if (req) { | |
| if (typeof req.addEventListener == "function") { | |
| req.addEventListener("progress", function(evt) { | |
| that.progress(evt); |
| import React from 'react'; | |
| import request from 'superagent'; | |
| // This import syntax requires the babel transform-export-extensions plugin | |
| import dispatcher, {actions} from '../lib/dispatcher'; | |
| export default class AddContact extends React.Component { | |
| submitHandler(event) { | |
| request.post('/api/contacts') | |
| .send({ | |
| firstName: this.refs.firstName.value, |
| _ |
| # Entity - Represent an important domain concept with identity and life cycle. | |
| class Education | |
| def initialize(institution, course, when) | |
| @institution = Institution.new(institution) # Institution is an Value Object that is immutable | |
| @course = Course.for(course) # Course is an Value Object too | |
| @period = period(when) # PostgreSQL's daterange Range Type | |
| end | |
| def course_ended? # Query method - Based on period, is CA still studying? |
| # Public: A module to be mixed in another class with common methods to index | |
| # records in ElasticSearch. | |
| # | |
| # The host object needs to respond to 'indexed_attributes', which will return | |
| # an array of the attributes names to be indexed. | |
| # | |
| # It's also recommended to override the 'save?' method to make sure only | |
| # records that match some specifications are indexed. | |
| # | |
| # The type used for the ElasticSearch index will be extracted from the name of |
| # But why not just this? | |
| # More straightfoward and faster to write... | |
| class Job < ActiveRecord::Base | |
| def publish | |
| update_attribute(:status, "published") | |
| JobActivityFeed.create("#{title} has been published", id) | |
| JobMailer.info_consultant(id, "consultant@cp.com").deliver | |
| end | |
| end |
| --colour | |
| -I app |