Remove unused and dangling docker images
docker rmi $(docker images -a -q)
| <?php | |
| /** | |
| * Implements hook_custom_theme(). | |
| * Switch to a custom theme when editing or adding a specific node type. | |
| */ | |
| function MYMODULE_custom_theme() { | |
| $args = arg(); | |
| $node_type = 'my_node_type'; // Node type. | |
| $theme = 'mytheme'; // Theme machine name. | |
| if(isset($args[2]) && $args[0] == 'node' && $args[2] == 'edit') { |
| // Get the value of a field. | |
| $my_field = field_get_items('user', $user, 'field_my_field_name'); | |
| $my_field_value = field_view_value('user', $user, 'field_my_field_name', $my_field[0]); | |
| print $my_field_value['#markup']; | |
| // Render a field. | |
| $entity = entity_load('1'); | |
| $my_node_field = field_view_field('node', $entity, 'field_my_field_name'); |
| # Backend API service example, uses nodemon to keep server alive and watch for changes. | |
| backendapi: | |
| # Tells docker-compose where ./backendapi/Dockerfile is | |
| build: ./backendapi | |
| # Allows live editing of ./backendapi/app | |
| volumes: | |
| - ./backendapi/app:/app | |
| # Launch Nodemon, using | |
| # -L legacy file watching for compatibility with boot2docker / docker-machine. | |
| # --watch defined to avoid watching the whole container and causing high CPU usage |
| const configureAnvil = function() { | |
| return anvil.discover() | |
| .then(function (configuration) { | |
| return anvil.getJWKs(); | |
| }, | |
| function(err) { | |
| console.log(err); | |
| }) | |
| .then(function (jwks) { | |
| // To redirect to the registration page instead of signup page use this: |
Remove unused and dangling docker images
docker rmi $(docker images -a -q)
| #! /bin/bash | |
| sudo apt-get update | |
| sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev -y | |
| git clone https://github.com/nghttp2/nghttp2.git && cd nghttp2 | |
| autoreconf -i | |
| automake | |
| autoconf | |
| ./configure --enable-apps | |
| make |
A curated list of non-trivial boilerplates, starter kits and examples of React.js based apps.
| /* | |
| * Client-side HTTP requests three ways, using ES6 syntax. | |
| * 1. jQuery.ajax() | |
| * 2. Superagent | |
| * 3. Fetch API | |
| * 4. Bonus helper | |
| */ | |
| // 1. jQuery.ajax() | |
| // http://api.jquery.com/jquery.ajax/ |
| # First, install the Amazon AWS CLI https://aws.amazon.com/cli/ | |
| # Then, add the following crontab by running `crontab -e` - this will backup file.ext every hour. | |
| 0 * * * * /usr/local/bin/aws s3 cp /path/to/back/file.ext s3://bucket-name/file.$(date +\%Y\%m\%d\%H\%M\%S).ext > /dev/null |
This structure should work well for small and medium size web applications or more document-focused websites. It provides a balance between co-location of component files and separation of components by function.
A 'layered' approach can be used when starting a build using this structure, starting with base styling, a few reusable components and some of your favourite utilities then building each space up.
The aim of this structure is to keep it obvious as to where things go, be able to define areas of ownership and importance and to keep things out of your way when working in a space. This structure scales well to many hundreds of components and works well with a single team workig on a frontend project.
In general, everything should be viewed as some type of encapsulated and independent component.