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
#!/usr/bin/env bash | |
git branch | grep -v "^*" | xargs git branch -D |
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
#!/usr/bin/env bash | |
git branch | grep -v $(git rev-parse --abbrev-ref HEAD) | xargs git branch -D |
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
function filter(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? […acc, item] : acc, []) | |
} |
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
function map(arr, fn) { | |
return arr.reduce((acc, item) => […acc, fn(item)], []) | |
} |
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
function find(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? acc || item : acc, undefined) | |
} |
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 myComponent extends React.Component { | |
constructor() { | |
super() | |
// Replace existing method with hardbound version of it | |
this.someMethod = someMethod.bind(this) | |
} | |
someMethod() { | |
// Do something that relies on 'this' |
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 | |
/** | |
* Plugin Name: Singleton Example | |
* Plugin URI: https://github.com/maurobringolf/wordpress-plugin-singleton | |
* Description: An empty illustration of a WordPress plugin implemented as singleton | |
* Author: Mauro Bringolf | |
* Author URI: https://maurobringolf.ch | |
* Version: 1.0 | |
* Text Domain: singleton | |
* Domain Path: languages |
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 | |
esc_html( $str ); //https://developer.wordpress.org/reference/functions/esc_html/ | |
esc_attr( $str ); //https://developer.wordpress.org/reference/functions/esc_attr/ | |
esc_url( $str ); //https://developer.wordpress.org/reference/functions/esc_url/ | |
esc_js( $str ); //https://developer.wordpress.org/reference/functions/esc_js/ | |
esc_textarea( $str ); //https://developer.wordpress.org/reference/functions/esc_textarea/ |
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 | |
sanitize_text_field( $str ); //https://developer.wordpress.org/reference/functions/sanitize_text_field/ | |
sanitize_title( $str ); //https://developer.wordpress.org/reference/functions/sanitize_title/ | |
sanitize_email( $str ); //https://developer.wordpress.org/reference/functions/sanitize_email/ | |
sanitize_file_name( $str ); //https://developer.wordpress.org/reference/functions/sanitize_file_name/ |
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 | |
is_numeric( $var ); //http://php.net/manual/de/function.is-numeric.php | |
is_array( $var ); //http://php.net/manual/de/function.is-array.php | |
is_object( $var ); //http://php.net/manual/de/function.is-object.php | |
is_string( $var ); //http://php.net/manual/de/function.is-string.php | |
isset( $data['key'] ); //http://php.net/manual/de/function.isset.php | |
in_array( $var, $arr ); //http://php.net/manual/de/function.is-array.php |
NewerOlder