PhpStorm now bundles WordPress coding style natively, starting from version 8.
- Go to
Project Settings>Code Style>PHP. - Select
Set From...(top right of window) >Predefined Style>WordPress.
No longer need to muck with this import! :)
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| <?PHP | |
| // Generates a strong password of N length containing at least one lower case letter, | |
| // one uppercase letter, one digit, and one special character. The remaining characters | |
| // in the password are chosen at random from those four sets. | |
| // | |
| // The available characters in each set are user friendly - there are no ambiguous | |
| // characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option, | |
| // makes it much easier for users to manually type or speak their passwords. | |
| // | |
| // Note: the $add_dashes option will increase the length of the password by |
| #!/usr/bin/env bash | |
| # memusg -- Measure memory usage of processes | |
| # Usage: memusg COMMAND [ARGS]... | |
| # | |
| # Author: Jaeho Shin <[email protected]> | |
| # Created: 2010-08-16 | |
| ############################################################################ | |
| # Copyright 2010 Jaeho Shin. # | |
| # # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); # |
| <?php | |
| // When loading WP from phpunit, phpunit doesn't run WP in the global scope. | |
| // This breaks WP. This is an attempt to fix it. | |
| function de_globalize_wp() { | |
| // pretend this is apache | |
| // I use $_SERVER['HTTP_HOST'] or a file called "host" to get the right DB settings | |
| $_SERVER['HTTP_HOST'] = trim(file_get_contents(__DIR__ . '/host')); |
| /* The API controller | |
| Exports 3 methods: | |
| * post - Creates a new thread | |
| * list - Returns a list of threads | |
| * show - Displays a thread and its posts | |
| */ | |
| var Thread = require('../models/thread.js'); | |
| var Post = require('../models/post.js'); |
| # Parses YouTube URLs directly or from iframe code. Handles: | |
| # * Address bar on YouTube url (ex: http://www.youtube.com/watch?v=ZFqlHhCNBOI) | |
| # * Direct http://youtu.be/ url (ex: http://youtu.be/ZFqlHhCNBOI) | |
| # * Full iframe embed code (ex: <iframe src="http://www.youtube.com/embed/ZFqlHhCNBOI">) | |
| # * Old <object> tag embed code (ex: <object><param name="movie" value="http://www.youtube.com/v/ZFqlHhCNBOI">...) | |
| /(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/ | |
| $5 #=> the video ID | |
| # test it on Rubular: http://rubular.com/r/eaJeSMkJvo |
| # Install Bash 4 using homebrew | |
| brew install bash | |
| # Or build it from source... | |
| curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz | |
| tar xzf bash-4.2.tar.gz | |
| cd bash-4.2 | |
| ./configure --prefix=/usr/local/bin && make && sudo make install | |
| # Add the new shell to the list of legit shells |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: