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 numpy as np; | |
import tensorflow as tf; | |
import pylab; | |
xAxis = [] | |
yAxis = [] | |
def make_data(n): | |
np.random.seed(42) # To ensure same data for multiple runs | |
x = 2.0 * np.array(range(n)) |
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 | |
add_filter('show_admin_bar', '__return_false'); |
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 | |
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2); | |
function special_nav_class ($classes, $item) { | |
if (in_array('current-menu-item', $classes) ){ | |
$classes[] = 'active '; | |
} | |
return $classes; | |
} |
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 | |
$where = [ | |
'meta_relation' => 'AND', | |
[ | |
'meta_key' => 'color', | |
'meta_vale' => 'blue' | |
], | |
[ | |
'meta_key' => 'weight', |
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 | |
$product = Product::find(15); | |
$product->hardDelete(); | |
echo $product->color; // NULL |
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 Product extends WP_Model | |
{ | |
... | |
public $virtual = [ | |
'humanWeight' | |
]; | |
public $serialize = [ | |
'humanWeight', |
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 Product extends WP_Model | |
{ | |
... | |
public function _finderHeavy($agrs){ | |
... | |
} | |
public function _postFinderHeavy($results, $args){ | |
return array_map(function($model){ |
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 Product extends WP_Model | |
{ | |
... | |
public function _finderHeavy($agrs){ | |
return [ | |
'posts_per_page' => '50', | |
'meta_query' => [ | |
[ | |
'key' => 'weight', |
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 Product extends WP_Model | |
{ | |
... | |
public function _finderHeavy(){ | |
return [ | |
'posts_per_page' => '50', | |
'meta_query' => [ | |
[ | |
'key' => 'weight', |
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 Product extends WP_Model | |
{ | |
... | |
public $filter = [ | |
'weight', | |
]; | |
public function _filterWeight($value){ | |
return intVal($value); |