We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':
- Our widget
Widget.svelte:
<script>
export let name;
</script>
<h1>Hello {name}!</h1>| <?php | |
| // Import arbitrary config from a variable. | |
| // Assumes $data has the data you want to import for this config. | |
| $config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
| $config->setData($data)->save(); | |
| // Or, re-import the default config for a module or profile, etc. | |
| \Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); |
| /** | |
| * Create a missing block (with empty fields but matching UUID). | |
| */ | |
| function yourmodule_post_update_create_a_missing_block() { | |
| $block_entity_manager = \Drupal::service('entity.manager')->getStorage('block_content'); | |
| $missing_uuid = 'CE7DA6B0-C2A0-4EE9-8F6B-8854A3705FB7'; | |
| $block = $block_entity_manager->create([ | |
| 'info' => 'Block title goes here', | |
| 'type' => 'block_type_machine_name_here', |
| const { execSync } = require('child_process') | |
| const { createHash } = require('crypto') | |
| const invertColor = require('invert-color') | |
| const branchName = execSync('git rev-parse --abbrev-ref HEAD') | |
| const hash = createHash('sha256') | |
| hash.update(branchName) | |
| const color = '#' + hash.digest().toString('hex').substring(0, 6) | |
| const invertedColor = invertColor(color, true) |
We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':
Widget.svelte:<script>
export let name;
</script>
<h1>Hello {name}!</h1>| git fetch upstream | |
| git reset --hard upstream/master |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| Host github.com | |
| User git | |
| Hostname github.com | |
| PreferredAuthentications publickey | |
| IdentityFile /home/user/.ssh/id_rsa |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |