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 convertSheet2Json(sheet) { | |
// first line(title) | |
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn()); | |
var firstRowValues = firstRange.getValues(); | |
var titleColumns = firstRowValues[0]; | |
// after the second line(data) | |
var lastRow = sheet.getLastRow(); | |
var rowValues = []; | |
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) { |
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
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
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
<?php | |
// Lớp database | |
class DB | |
{ | |
// Các biến thông tin kết nối | |
private $hostname = 'localhost', | |
$username = 'root', | |
$password = '', | |
$dbname = 'newspage'; |
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
@charset "UTF-8"; | |
/*CSS document - Charset kia giúp hiển thị tiếng Việt trong CSS*/ | |
*{ | |
margin: 0px; | |
} | |
body { | |
font-family: Verdana, Arial, Helvetica, sans-serif; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Đang học css</title> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<!-- <link rel="stylesheet" type="text/css" href="ngonngu.css"> --> | |
</head> | |
<body> |
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
Đây là những đoạn code bạn sẽ dùng thường xuyên trong quá trình lập trình theme wordpress. Bạn chỉ cần hiểu tác dụng của nó như thế nào sau đó copy và dán nó để chạy thôi. Mình đã viết sẵn cho bạn rồi, không cần phài suy nghĩ chi nhiều nhé he he. | |
1.Code lấy bài viết mặt định. | |
PHP: | |
<!-- Get post mặt định --> | |
<?php if (have_posts()) : ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php endwhile; else : ?> | |
<p>Không có</p> |
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 validateEmail(strEMail) { | |
//Validating the email field | |
var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ | |
if (!strEMail.match(reg)) { | |
return (false); | |
} | |
return(true); | |
} | |
// source: http://1tudien.com/js/warning.js |
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
# Matches patterns such as: | |
# https://www.facebook.com/my_page_id => my_page_id | |
# http://www.facebook.com/my_page_id => my_page_id | |
# http://www.facebook.com/#!/my_page_id => my_page_id | |
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456 | |
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678 | |
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number | |
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678 | |
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id | |
# http://www.facebook.com/my.page.is.great => my.page.is.great |
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
$text = "Ngày thử nhất tôi đăng ký một cái email là [email protected], ngày thứ hai tôi đăng ký là [email protected]"; | |
$res = preg_match_all("/[a-z0-9]+[_a-z0-9.-]*[a-z0-9]+@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})/i",$text,$matches); | |
if ($res) { | |
// array_unique loại bỏ các phần từ nào trùng nhau | |
foreach(array_unique($matches[0]) as $email) { | |
echo $email . ""; | |
} | |
} | |
// Kết quả: |
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 str_split_unicode($str, $l = 0) { | |
if ($l > 0) { | |
$ret = array(); | |
$len = mb_strlen($str, "UTF-8"); | |
for ($i = 0; $i < $len; $i += $l) { | |
$ret[] = mb_substr($str, $i, $l, "UTF-8"); | |
} | |
return $ret; | |
} |
OlderNewer