Skip to content

Instantly share code, notes, and snippets.

View giangmd's full-sized avatar

Giang D.MAI giangmd

View GitHub Profile
@giangmd
giangmd / last-word-uppercase.php
Created October 2, 2020 14:26
Last word in string to uppercase with PHP
function last_word_uppercase($sentence, $delimiter = ' ') {
$words = explode($delimiter, $sentence);
if (!empty($words)) {
$lastWord = array_pop($words);
$words[] = strtoupper($lastWord);
return implode($delimiter, $words);
}
return strtoupper($sentence);
}
@giangmd
giangmd / ripple-effect-css-only.html
Created January 13, 2020 07:07
Create ripple effect with CSS only
<!DOCTYPE html>
<html>
<head>
<title>Create ripple effect with CSS only</title>
<style>
.container {
background-color: #ffffff;
height: 500px;
display: flex;
justify-content: center;
<?php
$text = "Xin chào tất cả mọi người. Tôi tên là Giang. Hôm nay, tôi đến đây để làm việc. Chúc mọi người làm việc vui vẻ!";
$lang = "vi";
$file = md5($lang."?".urlencode($text));
$file = "audio/" . $file . ".mp3";
if (!is_dir("audio/"))
@giangmd
giangmd / css-parallax.html
Last active December 18, 2019 09:32
Css Parallax Background Image
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>CSS Parallax Background Image</title>
<style>
html, body, div {
height: 100%;
margin: 0;
@giangmd
giangmd / App.js
Created December 18, 2019 08:20
Reactjs Get Data from API
import React, { Component } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
class App extends Component {
constructor() {
super();
this.state = {
@giangmd
giangmd / site-maintenance.html
Created December 11, 2019 03:04
HTML Site Maintenance
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
@giangmd
giangmd / gist:66ecfa7dc51c78f03f5a6537a74814e5
Created November 14, 2019 03:15 — forked from thachpham92/gist:d57b18cf02e3550acdb5
Tất cả các tham số trong WP_Query
// Source: https://gist.github.com/luetkemj/2023628
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz
<?php
$args = array(
//////Author Parameters - Tham số lấy bài viết theo tác giả
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20)
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả
@giangmd
giangmd / compareimage.php
Created January 29, 2019 09:05
Image JPG compare
<?php
function compareImages($imagePathA, $imagePathB, $accuracy)
{
// load base image
$bim = imagecreatefromjpeg($imagePathA);
// create comparison points