Skip to content

Instantly share code, notes, and snippets.

View quangpro1610's full-sized avatar
🏠
Working from home

Hoang Quang quangpro1610

🏠
Working from home
View GitHub Profile
@quangpro1610
quangpro1610 / weather-bot-vietnam.php
Created June 10, 2021 09:10
Xử lý lấy dữ liệu thời tiết trong ngày tại địa điểm
<?php
header('Content-Type: application/json; charset=utf-8');
$api_key = 'PUT_API_KEY_HERE';
if(!empty($_GET['province'])){
$province = $_GET['province'];
}else{
$province = 'Quang Tri';
}
$url = 'http://api.openweathermap.org/data/2.5/weather?q=' . $province . ',vietnam&appid=' . $api_key . '&units=metric&lang=vi';
$content = file_get_contents($url);
@quangpro1610
quangpro1610 / open-weather-map-api.php
Last active June 5, 2021 10:24
The API for Weather
<?php
header('Content-Type: application/json; charset=utf-8');
$api_key = 'PUT YOUR API HERE';
if(!empty($_GET['province'])){
$province = $_GET['province'];
}else{
$province = 'Quang Tri';
}
$url = 'http://api.openweathermap.org/data/2.5/forecast?q=' . $province . ',vietnam&appid=' . $api_key . '&units=metric&lang=vi';
$content = file_get_contents($url);
<?php
header('Content-Type: text/html; charset=utf-8');
$url = file_get_contents('https://api.tumblr.com/v2/blog/gaixinhchonloc.com/posts/photo?api_key=OAuth_Consumer_Key');
$json = json_decode($url, true);
$json_posts = $json['response']['posts'];
$data = array();
foreach ($json_posts as $key => $value) {
$data[] = $value['photos'][0]['original_size']['url'];
}
@quangpro1610
quangpro1610 / corona.php
Last active February 16, 2022 10:40
API get data sumary about corona virus of Vietnam and Global
<?php
header('Content-Type: text/html; charset=utf-8');
$url = 'https://code.junookyo.xyz/api/ncov-moh/data.json';
$content = file_get_contents($url);
$json = json_decode($content, true);
$data = $json['data'];
$result = array(
'messages' => array(
'0' => array(

Keybase proof

I hereby claim:

  • I am quangpro1610 on github.
  • I am quangpro1610 (https://keybase.io/quangpro1610) on keybase.
  • I have a public key ASBwBpFA9pbsTcbQ5z78XiAW6IZO32Ry7g7RkWvOPJaYZwo

To claim this, I am signing this object:

@quangpro1610
quangpro1610 / AND_OR_NOT
Created January 14, 2019 16:01 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@quangpro1610
quangpro1610 / time-read-post.js
Created January 11, 2019 04:48
Add Estimated Reading Time to Your Blog
//<![CDATA[
(function(e){
e.fn.readingTime=function(n){
var t={
readingTimeTarget:".eta",
wordCountTarget:null,
wordsPerMinute:270,
round:!0,
lang:"en",
lessThanAMinuteString:"",
@quangpro1610
quangpro1610 / wp-schedule.md
Created November 1, 2018 04:13 — forked from adamdehaven/wp-schedule.md
Schedule events in WordPress

You probably already know that WordPress can schedule events. For example, it can publish posts at preset dates and times. Using hooks and wp-cron, we can easily schedule our own events. In this example, we will get our WordPress blog to send us an email once hourly.

The solution

Paste the following code block in the functions.php file of your theme.

if (!wp_next_scheduled('my_task_hook')) {
  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
}
* {
margin: 0;
padding: 0;
}
body {
background: #ccc;
font-family: arial, verdana, tahoma;
}
.accordian {
width: 805px;
<div class="accordian">
<ul>
<li>
<div class="image_title"> <a href="#">KungFu Panda</a> </div>
<a href="#"> <img src="./img/3yiC6Yq.jpg" /> </a>
</li>
<li>
<div class="image_title"> <a href="#">Toy Story 2</a> </div>
<a href="#"> <img src="./img/40Ly3VB.jpg" /> </a>
</li>