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 the module you’ll use to simulate the computer’s choices: | |
import random | |
# take the user input | |
user_action = input("Enter a choice (rock, paper, scissors): ") | |
# Define the possible choices and let the computer choose one of them randomly | |
possible_actions = ["rock", "paper", "scissors"] | |
computer_action = random.choice(possible_actions) |
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 the module you’ll use to simulate the computer’s choices: | |
import random | |
while True: | |
# take the user input | |
user_action = input("Enter a choice (rock, paper, scissors): ") | |
# Define the possible choices and let the computer choose one of them randomly | |
possible_actions = ["rock", "paper", "scissors"] |
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 this code within the function file | |
function set_post_views($postID) { | |
$count_key = ‘post_views_count’; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==”){ | |
$count = 0; | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, ‘0’); |
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 | |
function track_post_views ($post_id) { | |
if ( !is_single() ) return; | |
if ( empty ( $post_id) ) { | |
global $post; | |
$post_id = $post->ID; | |
} | |
set_post_views($post_id); | |
} |
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 | |
function get_post_views($postID){ | |
$count_key = ‘post_views_count’; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==”){ | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, ‘0’); | |
return "0 View"; | |
} |
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 | |
function get_remote_data($url, $post_paramtrs = false) { | |
$c = curl_init(); | |
curl_setopt($c, CURLOPT_URL, $url); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
if ($post_paramtrs) { | |
curl_setopt($c, CURLOPT_POST, TRUE); | |
curl_setopt($c, CURLOPT_POSTFIELDS, "var1=bla&" . $post_paramtrs); | |
} curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 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 | |
function callAPI($method, $url, $data){ | |
$curl = curl_init(); | |
switch ($method){ | |
case "POST": | |
curl_setopt($curl, CURLOPT_POST, 1); | |
if ($data) | |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); | |
break; |
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
from spellchecker import SpellChecker | |
spell = SpellChecker() | |
word = input("Enter your Word : ") | |
if word in spell: | |
print("Correct Spelling") | |
else: | |
print("Incorrect Spelling") |
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 numeric_posts_nav() { | |
if( is_singular() ) | |
return; | |
global $wp_query; | |
/** Stop execution if there's only 1 page */ | |
if( $wp_query->max_num_pages <= 1 ) | |
return; |
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
.navigation li a, | |
.navigation li a:hover, | |
.navigation li.active a, | |
.navigation li.disabled { | |
color: #fff; | |
text-decoration:none; | |
} | |
.navigation li { | |
display: inline; |