Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Davis Tibbz Longwater1234

🎯
Focusing
View GitHub Profile
@Longwater1234
Longwater1234 / getcalories.js
Created Mar 23, 2021
Back4App Parse Calories Cloud Code
View getcalories.js
const axios = require("axios").default;
//CLOUD function for getting calories for given `foodName`
Parse.Cloud.define("getcalories", async(request) => {
const foodName = request.params.foodName;
const options = {
method: "GET",
url: "https://api.calorieninjas.com/v1/nutrition",
params: { query: foodName },
headers: {
@Longwater1234
Longwater1234 / uploadfile.php
Last active Feb 14, 2021
PHP IMAGE file upload using MYSQLi
View uploadfile.php
<?php
//this simple example uses MYSQLi to upload an PHOTO file to an SQL database.
//modify the HTML part as you wish to make it prettier OR ADD MORE inputs fields.
/* USE this for PHOTO uploads ONLY. WON'T work with PDF, DOC etc. */
// ALSO, do not ignore escaping strings or using PREpared statements for security.
mysqli_report( MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT );
$conn = mysqli_connect( $HOSTNAME, $DB_USERNAME, $DB_PASSWORD, "_YOUR_DB_NAME_HERE" );
@Longwater1234
Longwater1234 / main.js
Last active Dec 30, 2020
Back4App Parse Braintree Cloud Code
View main.js
/* FINAL FINAL FINAL*/
// UPLOAD THIS CODE IN your BACK4APP CLOUD CONSOLE.
//LAST UPDATED 30.12.2020
// Requiring npm module
const braintree = require("braintree");
// Initializing gateway
const gateway = new braintree.BraintreeGateway({
environment: braintree.Environment.Sandbox,