- Go to https://takeout.google.com, making sure to log in (or be logged in already) as the owner of the targeted Gmail account.
- Deselect all, then select only Mail
- Click "All data included", otherwise you will download the entire mailbox!
- In the resulting popup, deselect all the annoying default labels and select only the ones you want, e.g. "Project X"
- Close the pop-up and click "next"
- Choose
- file type for compression (.tgz for Mac and Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function stop_modified_date_update( $new, $old ) { | |
| $new['post_modified'] = $old['post_modified']; | |
| $new['post_modified_gmt'] = $old['post_modified_gmt']; | |
| return $new; | |
| } | |
| add_filter( 'wp_insert_post_data', 'stop_modified_date_update', 10, 2 ); | |
| // do stuff that updates post(s) here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ### How to use [Puppeteer](https://github.com/GoogleChrome/puppeteer) for visual diffing | |
| #### Install the following NPM packages: puppeteer, pixemmatch, fs-extra and pngjs (first time only) in the directory where you want to keep your tests | |
| ```npm install --save-dev puppeteer pixelmatch fs-extra pngjs``` | |
| #### Create your testing script (first time only); what follows is a simplified example that tests only 2 pages | |
| ``` | |
| */ | |
| const puppeteer = require('puppeteer'); | |
| const pixelmatch = require('pixelmatch'); | |
| const fs = require('fs-extra'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Tired of making changes to your WordPress site's stylesheet, only to have the client tell you "It looks the same to me!"? | |
| // Force WordPress to send a fresh copy to logged-in users with this simple code snippet. | |
| // (In practice, put this code in your WordPress theme (e.g., in functions.php) or in a custom plugin.) | |
| $now = new DateTime(); | |
| $now_version = $now->format('YmdHis'); | |
| if (is_user_logged_in()) { | |
| wp_enqueue_style( 'pacificbiosciences-style', get_stylesheet_uri(), array(), $now_version ); | |
| } else { | |
| wp_enqueue_style( 'pacificbiosciences-style', get_stylesheet_uri() ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const puppeteer = require('puppeteer'); | |
| const pixelmatch = require('pixelmatch'); | |
| const fs = require('fs-extra'); | |
| const PNG = require('pngjs').PNG; | |
| const testNum = 0; // EDIT before each individual test | |
| const dPath = 'apple.com-20180704'; // EDIT before each set of tests | |
| const filenameBase = 'apple-test'; | |
| const pathBase = dPath + testNum + '/' + filenameBase; | |
| (async () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [6] pry(#<Post>):1> nesting | |
| Nesting status: | |
| -- | |
| 0. main (Pry top level) | |
| 1. #<Post> | |
| [7] pry(#<Post>):1> self.to_s | |
| => "#<Post:0x00007fdad6ce57a8>" | |
| [8] pry(#<Post>):1> self.title = "This is a Title Made with Pry" | |
| => "This is a Title Made with Pry" | |
| [9] pry(#<Post>):1> self.title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| </php | |
| // In this example, only logged-in users with the 'activate_plugins' capability will be able to delete files shown in the Media Library. | |
| // (By default, only administrators have this capability.) | |
| // This code should be put in functions.php or in a plugin. | |
| add_action('delete_attachment', array($this, 'restrict_media_deletion_permissions'), 1); | |
| public function restrict_media_deletion_permissions($post_id) { | |
| if (! current_user_can('activate_plugins')) { | |
| ?> | |
| <script type="text/javascript">alert("You do not have permission to delete media files.");</script> | |
| <?php |
#Array-to-parameter-list conversion
##During a recent mock technical interview, I was asked to find the largest of a series of numbers stored in an array. The first solution I hit upon was to feed all the array members to Math.max(), but I just couldn't figure out how to do it, and I ended up taking another approach. When the interview was over, the interviewer gave me two ways I could've made my original idea work.
###(1) Use apply()
const numberArray = [12, 45, 0, 7];
return Math.max.apply( null, numberArray ); // 45
###(2) Use the new spread operator
NewerOlder