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 | |
class GreetingGenerator { | |
public function get_greeting( $name ) { | |
// Assumes determine_greeting is defined in another file | |
return determine_greeting( $name ); | |
} | |
} | |
class Greeter { |
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
// Set up DOM | |
var jsdom = require( 'jsdom' ).jsdom; | |
global.document = jsdom( '' ); | |
global.window = document.defaultView; | |
global.navigator = document.defaultView.navigator; | |
// Prepare React | |
var ReactTestUtils = require( 'react-addons-test-utils' ); | |
var React = require( 'react' ); |
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
var getWindow = require( './window' ).getWindow; | |
function getSomethingFromTheDOM() { | |
return getWindow().document.querySelector( '.something' ); | |
} |
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
<? | |
class FunctionalFuncs { | |
public static function compose() { | |
$function_reducer = function ( $result, $func ) { | |
return [ call_user_func_array( $func, $result ) ]; | |
}; | |
$callbacks = func_get_args(); | |
return function() use ( $callbacks, $function_reducer ) { | |
$arguments = func_get_args(); | |
return array_reduce( $callbacks, $function_reducer, $arguments )[0]; |
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 | |
require_once( 'get-deep-value.php' ); | |
/** | |
* @runTestsInSeparateProcess | |
*/ | |
class Get_Deep_Value_Test extends PHPUnit_Framework_TestCase { | |
use Codeception\Specify; |
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
import React from 'react'; | |
const Header = () => <div className="header"><img className="header__logo" src="/assets/logo.png" /><h1 className="header__title">My App</h1></div>; | |
const ToDoList = () => <div className="to-do-list"><h2 className="to-do-list__title">To Do</h2></div>; | |
const Controls = () => <div className="controls"><h2 className="controls__title">Controls</h2></div>; | |
const Footer = () => <div className="footer">Made by Me</div>; | |
export default React.createClass( { | |
render() { | |
return ( |
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 | |
class SomeClass { | |
public function do_something( $times ) { | |
$user = wp_get_current_user(); | |
//... | |
return true; | |
} | |
} |
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
" Highlight ES6 template strings | |
hi link javaScriptTemplateDelim String | |
hi link javaScriptTemplateVar Text | |
hi link javaScriptTemplateString String |
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
{ | |
"require-dev": { | |
"10up/wp_mock": "dev-master" | |
} | |
} |
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
var loadTasks = require( 'load-grunt-tasks' ); | |
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
nodemon: { | |
dev: { | |
script: 'server.js', |