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
# Wordpress php.ini configuration | |
upload_max_filesize = 32M | |
post_max_size = 32M | |
memory_limit = 128M | |
max_execution_time = 60 | |
max_input_vars = 10000 | |
max_input_time = 30 |
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
add_filter( 'user_contactmethods','huraji_contactmethods', 20, 1 ); | |
function huraji_contactmethods( $contact_methods ) { | |
$contact_methods['linkedin'] = __( 'LinkedIn URL', 'text_domain' ); | |
$contact_methods['github'] = __( 'Github URL', 'text_domain' ); | |
$contact_methods['youtube'] = __( 'YouTube URL', 'text_domain' ); | |
return $contact_methods; | |
} |
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
function get_url_param(name){ | |
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href); | |
if (results==null){ | |
return null; | |
} else { | |
if(results[1].indexOf("#")){ | |
results = results[1].split("#"); | |
results = results[0]; | |
} else { | |
results = results[1] || 0; |
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
from matplotlib import pyplot as plt | |
#Set data to display > [lists] | |
x = [1,7,5,2] | |
y1 = [5,6,3,9] | |
y2 = [7,8,4,0] | |
#Create plots with line colors and marker style | |
plt.plot(x, y1, color="pink", marker="o") | |
plt.plot(x, y2, color="gray", marker="o") |
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 numpy as np | |
#Get data from CSV | |
#Temperatures recorded 4 times a day, at 0:00, 6:00, 12:00, and 18:00. Last weeks data (Monday through Friday) | |
temperatures = np.genfromtxt('temperature_data.csv', delimiter=',') | |
#Adjust temperatures | |
temperatures_fixed = temperatures + 3.0 | |
#Select Monday's Temperatures |
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 pandas as pd | |
#Read CSV file | |
orders = pd.read_csv('shoefly.csv') | |
#Inspect first 5 lines | |
print(orders.head(5)) | |
#Get a specific serie of data / column | |
emails = orders['email'] |
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
/* | |
* @param $tag = tag to use for this transient | |
* @param $element = value to associate the transient | |
* @param $duration / $expiration = time in seconds > 3600*24 for 1 day | |
* @return true > if needed to update | false > if still not expired | |
*/ | |
function update_transient($tag, $element, $duration, $expiration){ | |
$elements_in_tag = get_transient($tag); |
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
/* | |
* Put this function in your plugin or functions.php and pass the parameter $log to be debugged. | |
* Example: wpui_write_log( $log ) where $log is the data to be debugged. | |
* It writes into /debug.log of your wp-content/ | |
* Could be used as class method as well | |
*/ | |
function wpui_write_log( $log ) { | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( print_r( $log, true ) ); |
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 LinearRegression methods from Scikit-Learn | |
from sklearn.linear_model import LinearRegression | |
import matplotlib.pyplot as plt | |
import numpy as np | |
#Data of Soup sales with their temperature | |
temperature = np.array(range(60, 100, 2)) | |
temperature = temperature.reshape(-1, 1) | |
sales = [65, 58, 46, 45, 44, 42, 40, 40, 36, 38, 38, 28, 30, 22, 27, 25, 25, 20, 15, 5] |
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
from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score | |
#True labels and predicted classifications | |
labels = [1, 0, 0, 1, 1, 1, 0, 1, 1, 1] | |
guesses = [0, 1, 1, 1, 1, 0, 1, 0, 1, 0] | |
#Calculate accuracy, recall, precision and f1 score | |
print(accuracy_score(labels, guesses)) | |
print(recall_score(labels, guesses)) | |
print(precision_score(labels, guesses)) |
OlderNewer