Tutorial by Examples: comp

Add the hyperloop gem to your rails (4.0 - 5.1) Gemfile bundle install Add the hyperloop manifest to the application.js file: // app/assets/javascripts/application.js ... //= hyperloop-loader Create your react components, and place them in the hyperloop/components directory # app/hyperl...
class Hello < Hyperloop::Component # params (= react props) are declared using the param macro param :guest render do "Hello there #{params.guest}" end end # to "mount" Hello with guest = "Matz" say Hello(guest: 'Matz') # params can be giv...
Let's say we want to console.log each time the component mounts: hocLogger.js export default function hocLogger(Component) { return class extends React.Component { componentDidMount() { console.log('Hey, we are mounted!'); } render() { return <Component {...this....
Let's say we have a component that should only be displayed if the user is logged in. So we create a HOC that checks for the authentication on each render(): AuthenticatedComponent.js import React from "react"; export function requireAuthentication(Component) { return class Auth...
Note that OTP>=19 required (if you want to upgrade it using release_handler). Go to director and use rebar or rebar3. Pouriya@Jahanbakhsh ~ $ cd director rebar Pouriya@Jahanbakhsh ~/director $ rebar compile ==> director_test (compile) Compiled src/director.erl Pouriya@Jahanbakhsh ~/di...
Compress-Archive -Path C:\Documents\* -CompressionLevel Optimal -DestinationPath C:\Archives\Documents.zip This command: Compresses all files in C:\Documents Uses Optimal compression Save the resulting archive in C:\Archives\Documents.zip -DestinationPath will add .zipif not present. -Li...
Compress-Archive -Path C:\Documents\* -Update -DestinationPath C:\Archives\Documents.zip this will add or replace all files Documents.zip with the new ones from C:\Documents
In the new Angular framework, Components are the main building blocks that compose the user interface. So one of the first steps that helps an AngularJS app to be migrated to the new Angular is to refactor it into a more component-oriented structure. Components were also introduced in the old Angu...
Lets assume that we have a complex api, with many generic views and some generic viewsets. We want to enable PageNumberPagination to every view, except one (either generic view or viewset, does not make a difference) for which we want a customized case of LimitOffsetPagination. To achieve that we n...
It is possible to DELETE data from a table if it matches (or mismatches) certain data in other tables. Let's assume we want to DELETEdata from Source once its loaded into Target. DELETE FROM Source WHERE EXISTS ( SELECT 1 -- specific value in SELECT doesn't matter FROM Target ...
SCSS syntax resembles more like a CSS syntax but SASS syntax is little bit different from SCSS but both produces exactly the same CSS code. In SASS we are not ending the style properties with semicolon(;) but in SCSS we are ending the style properties with (;). In SCSS we used paranthesis {} to ...
Function using promises: function myAsyncFunction() { return aFunctionThatReturnsAPromise() // doSomething is a sync function .then(result => doSomething(result)) .catch(handleError); } So here is when Async/Await enter in action in order to get clean...
Another convenient solution for cross compilation is the usage of gox: https://github.com/mitchellh/gox Installation The installation is done very easily by executing go get github.com/mitchellh/gox. The resulting executable gets placed at Go's binary directory, e.g. /golang/bin or ~/golang/bin. E...
As java provide two different commands to compile and run Java code. Same as Kotlin also provide you different commands. javac to compile java files. java to run java files. Same as kotlinc to compile kotlin files kotlin to run kotlin files.
Numeric values can compared with = and the other numeric comparison operators (/=, <, <=, >, >=) that ignore the difference in the physical representation of the different types of numbers, and perform the comparison of the corresponding mathematical values. For instance: (= 42 42) T ;...
Common Lisp has 12 type specific operators to compare two characters, 6 of them case sensitives and the others case insensitives. Their names have a simple pattern to make easy to remember their meaning: Case SensitiveCase InsensitiveCHAR=CHAR-EQUALCHAR/=CHAR-NOT-EQUALCHAR<CHAR-LESSPCHAR<=CHA...
The core idea is to use GameObjects to represent singletons, which has multiple advantages: Keeps complexity to a minimum but supports concepts like dependency injection Singletons have a normal Unity lifecycle as part of the Entity-Component system Singletons can be lazy loaded and cached loca...
We can use the componentchanged event to listen for changes to the entity: entity.addEventListener('componentchanged', function (evt) { if (evt.detail.name === 'position') { console.log('Entity has moved from', evt.detail.oldData, 'to', evt.detail.newData, '!'); } });
Updating Multi-Property Component Data To update component data for a multi-property component, we can pass the name of a registered component as the componentName, and pass an object of properties as the value. A string is also acceptable (e.g., type: spot; distance: 30), but objects will save A-F...
For example, if we wanted to grab an entity’s three.js camera object or material object, we could reach into its components var camera = document.querySelector('a-entity[camera]').components.camera.camera; var material = document.querySelector('a-entity[material]').components.material.material; ...

Page 31 of 34