If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
require "../config.php"; | |
require "../common.php"; | |
try { | |
$connection = new PDO($dsn, $username, $password, $options); | |
$new_user = array( | |
"firstname" => $_POST['firstname'], | |
"lastname" => $_POST['lastname'], | |
"email" => $_POST['email'], |
<?php | |
/* | |
* Mysql database class - only one connection alowed | |
*/ | |
class Database { | |
private $_connection; | |
private static $_instance; //The single instance | |
private $_host = "HOSTt"; | |
private $_username = "USERNAME"; | |
private $_password = "PASSWORd"; |
<?php | |
class Db | |
{ | |
private $_connection; | |
private static $_instance; //The single instance | |
private $_host = DB_HOST; | |
private $_username = DB_USER; | |
private $_password = DB_PASSWORD; | |
private $_database = DB_DB; |
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform |
models.inventory_transaction.findAll( | |
{ attributes: [[models.sequelize.fn('sum', models.sequelize.col('quantity')), 'total']], | |
include : [ | |
{ | |
model : models.product_entry, | |
attributes: [], | |
include : [ | |
{ | |
model : models.product, | |
attributes: [['name', 'name']] |
In PHP | |
function calculate_distance($lat1, $lon1, $lat2, $lon2, $unit='N') | |
{ | |
$theta = $lon1 - $lon2; | |
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
$dist = acos($dist); | |
$dist = rad2deg($dist); | |
$miles = $dist * 60 * 1.1515; | |
$unit = strtoupper($unit); |
In PHP | |
function calculate_distance($lat1, $lon1, $lat2, $lon2, $unit='N') | |
{ | |
$theta = $lon1 - $lon2; | |
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
$dist = acos($dist); | |
$dist = rad2deg($dist); | |
$miles = $dist * 60 * 1.1515; | |
$unit = strtoupper($unit); |
<script src="http://maps.googleapis.com/maps/api/js?libraries=places" type="text/javascript"></script> | |
<script type="text/javascript"> | |
function initialize() { | |
var input = document.getElementById('searchTextField'); | |
var autocomplete = new google.maps.places.Autocomplete(input); | |
google.maps.event.addListener(autocomplete, 'place_changed', function () { | |
var place = autocomplete.getPlace(); | |
document.getElementById('city2').value = place.name; | |
document.getElementById('cityLat').value = place.geometry.location.lat(); |
//logic | |
exports.getProducts = (req, res, next) => { | |
const page = +req.query.page || 1; | |
let totalItems; | |
Product.find() | |
.countDocuments() | |
.then(numProducts => { | |
totalItems = numProducts; | |
return Product.find() |