From currying to closures there are quite a number of special words used in JavaScript. These will not only help you increase your vocabulary but also better understand JavaScript. Special terms are normally found in documentation and technical articles. But some of them like closures are pretty standard things to know about. Knowing what the word itself means can help you know the concept it's named for better.
This file contains 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 Marko_Shortcodes { | |
public function __construct() { | |
add_shortcode( 'engine_info', array( $this, 'engine_info' ) ); | |
} | |
public function engine_info( $atts ) { | |
global $wp_version, $wpdb, $batcache, $wp_object_cache; |
This file contains 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
//create subscription | |
// $20 a month | |
curl https://api.stripe.com/v1/customers/cus_18nj91X8lMXyju/subscriptions | |
-u private key: | |
-d plan=gold | |
//change subscription - upgrade plan | |
//$40 a month | |
curl https://api.stripe.com/v1/customers/cus_18nj91X8lMXyju/subscriptions/sub_4HWcxqoS8wG7T3 \ | |
-u private key: \ |
This file contains 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
// html | |
<label for="year">Год</label> | |
<select name="year" id="year"></select> | |
<label for="month">Месяц</label> | |
<select name="month" id="month"> | |
<option value = "1">01</option> | |
<option value = "2">02</option> | |
<option value = "3">03</option> | |
<option value = "4">04</option> |
This file contains 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
/** | |
* Helper class for controlling all aspects of a view. | |
* | |
* Supported methods (automatically hooked): | |
* - init() - for registering post types, taxonomies, rewrite rules etc. | |
* - parse_query() - for correcting query flags | |
* - pre_get_posts() - for altering the query, without affecting the query flags | |
* - posts_search(), posts_clauses(), posts_request() - for direct SQL manipulation | |
* - the_posts() - for various other manipulations | |
* - template_redirect() - for enqueuing scripts etc. |
This file contains 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'; | |
class JsonDump extends React.Component { | |
static propTypes = { | |
children: React.PropTypes.any | |
} | |
render() { | |
return <pre>{JSON.stringify(this.props.children, null, 4)}</pre> | |
} |
A pure function for given the same input will always return the same output and evaluation of this function will not cause any side effects.
- easy to test, as they always return the same value,
- easy to debug, as they shouldn't cause any race conditions and circular dependencies,
- simple and independent, as they don't cause any side effects (it makes design clean),
- easy to scale application up, as they shouldn't rely on machine state.
This file contains 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 | |
add_action( 'registered_taxonomy', array( 'APP_Tax_Admin_Column', 'register_column' ), 10, 3 ); | |
/** | |
* Generates a column with the associated terms, | |
* for any taxonomy with 'show_admin_column' => true | |
*/ | |
class APP_Tax_Admin_Column { |
This gist is for showing an example of a custom wordpress menu.
If you want to get more from the menu item simply have a look at the $item object. i.e:
// Will return a large object with lots of props like title, url, description, id etc.
var_dump( $item );
This code works on Wordpress 4.1.1 as of 31st of March 2015
OlderNewer