Instantly share code, notes, and snippets.

👨‍💻
Learning Node.js deeply

Niels Lange nielslange

View GitHub Profile
View functions.php
<?php
$post_type = 'products';
$taxonomy = 'products-category';
// Fetch root categories
$root_cat_args = array(
'taxonomy' => $taxonomy,
'hide_empty' => false,
'parent' => 0,
View function.php
add_action( 'wp_head', 'add_signature' );
function add_signature() {
?>
<!--
_____ _ _ _
| __ \ | | | | | |
| |__) _ __ __ _ _ __ ___ __ _| |_| |__ ___ ___| |__
| ___| '__/ _` | '_ ` _ \ / _` | __| '_ \ / _ / __| '_ \
| | | | | (_| | | | | | | (_| | |_| | | | __\__ | | | |
View index.html
<input type="number" id="number" value="0" />
<button type="button" onclick="increaseValue()">+</button>
<button type="button" onclick="decreaseValue()">-</button>
<button type="button" onclick="resetValue()">Reset</button>
View index.html
<div style="display: flex; align-items: center; justify-content: space-around;">
<div style="flex: 1; padding: 10px;">
</div>
<div style="flex: 1; padding: 10px;">
</div>
<div style="flex: 1; padding: 10px;">
</div>
</div>
View style.css
/* Position menu above site title */
#masthead {
display: flex;
flex-direction: column;
}
#masthead .site-branding {
order: 2;
}
#masthead .main-navigation {
order: 1;
View isPalindrom.js
function isPalindrom(string) {
var palindrom = true;
for ( i = 0; i < (string.length / 2); i++ ) {
if ( string.charAt(i) != (string.charAt(string.length - i - 1)) ) {
palindrom = false;
break;
}
}
View gist:6ea635bed0d15c6276aa7f3780585212
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
View index.html
p {
color: red;
text-align: center;
}
View sample.php
<?php
add_action('peepso_after_login_form', 'hook');
/*
* Prints ExampleProvider login button after the PeepSo login forms
*/
hook() {
echo '<div style="exampleprovider-login">';
echo '<a onlick="exampleprovider.auth()>';
_e('Login With ExampleProvider!', '');
View sample.php
<?php
add_action('peepso_action_user_activate', 'hook', 10, 1);
/*
* Send an email to admin each time a new group is created
*/
hook(PeepSoUser $PeepSoUser) {
$msg = "New user {$PeepSoUser->get_fullname()} ID {$PeepSoUser->get_id()}";
error_log($msg);
}