- Exploring Project Structure Open a directory in Vim
vim
vim .
Navigate in netrw Key Action
vim
vim .
Navigate in netrw Key Action
Following "manual import" instructions on Windows: https://localwp.com/help-docs/getting-started/how-to-import-a-wordpress-site-into-local/#Manually-Import-a-Local-site.
I get the error when running wp db import db.sql in LocalWP's site shell:
Error: Failed to get current SQL modes. Reason: ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
Use this command instead.
| <?php | |
| // Note: [ACF Local JSON Sync](https://www.advancedcustomfields.com/resources/local-json/) must be set up for this strategy. | |
| // Otherwise, just tweak the logic for detecting the field_group. | |
| function _get_acf_fields_by_fieldgroup_slug( $slug ) { | |
| if ( !$slug ) return null; | |
| $acf_field_groups = acf_get_field_groups(); | |
| $fields = []; | |
| foreach( $acf_field_groups as $group ) { |
| # Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
| # Backup old data | |
| Rename-Item -Path "./data" -NewName "./data_old" | |
| # Create new data directory | |
| Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
| Remove-Item "./data/test" -Recurse | |
| $dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
| Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
| add_filter( 'graphql_PostObjectsConnectionOrderbyEnum_values', function( $values ) { | |
| $values['LIKE_COUNT'] = [ | |
| 'value' => 'like_count', | |
| 'description' => __( 'The number of likes on the post', 'wp-graphql' ), | |
| ]; | |
| return $values; | |
| } ); |
| // check version | |
| node -v || node --version | |
| // list locally installed versions of node | |
| nvm ls | |
| // list remove available versions of node | |
| nvm ls-remote | |
| // install specific version of node |
| # source: https://www.youtube.com/watch?v=gEceSAJI_3s | |
| # create a .env file for db creds | |
| version: '3.1' | |
| services: | |
| database: | |
| mem_limit: 2048m | |
| image: mariadb:10.6.4-focal | |
| restart: unless-stopped |
| " Don't try to be vi compatible | |
| set nocompatible | |
| " Helps force plugins to load correctly when it is turned back on below | |
| filetype off | |
| " TODO: Load plugins here (pathogen or vundle) | |
| " Turn on syntax highlighting | |
| syntax on |
| // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB | |
| if (!window.indexedDB) { | |
| console.log('Your browser does not support indexedDB!') | |
| } | |
| const customerData = [ | |
| { ssn: "444-44-4444", name: "Bill", age: 35, email: "bill@company.com" }, | |
| { ssn: "555-55-5555", name: "Donna", age: 32, email: "donna@home.org" }, | |
| { ssn: "344-44-4444", name: "Bill", age: 31, email: "billl@company.com" }, |
| // const savedTimestamp = 1690509844000 // saved over 12 hours ago in localStorage | |
| const savedTimestamp = 1690553044000 // saved under 12 hours ago in localStorage | |
| const twelveHoursDifference = 43200000 // 12 hours in milliseconds | |
| const now = new Date().getTime() // current timestamp | |
| const isDataStale = (now, timestamp, difference) => now > timestamp + difference | |
| const shouldRefresh = isDataStale(now, savedTimestamp, twelveHoursDifference) | |
| console.log(shouldRefresh) |