Skip to content

Instantly share code, notes, and snippets.

View f13dev's full-sized avatar

Jim Valentine f13dev

View GitHub Profile
<?php
function currencyConvert($from,$amount,$to) {
// Initiate curl
$curl = curl_init();
// Set the curl URL and options
curl_setopt($curl, CURLOPT_URL, 'https://api.exchangeratesapi.io/latest?base=' . $from);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// Get the output from the curl request
$output = curl_exec($curl);
// Decode the output
@f13dev
f13dev / eliquid.txt
Last active April 3, 2019 08:28
HP 39/40 Eliquid mixing calculator. Copy this code to a new program in your calculator and then when ran you are asked to enter: A VG ratio, A concentrate nicotine strength, A desired nicotine strength, A flavour percentage and the quantity to make. You will be presented with the required quantities. This assumes that your flavour and nicotine i…
EXPORT ELIQUID()
BEGIN
LOCAL DP = 2)
INPUT(V,"VG percentage");
INPUT(N,"Concentrate nicotine mg/ml");
INPUT(D,"Desired nicotine mg/ml");
INPUT(F,"Flavour percentage");
INPUT(M,"Quantity to make (ml)");
PRINT();
@f13dev
f13dev / tomcat_start
Last active September 18, 2016 17:44
Bash script to start and/or stop Apache Tomcat on MacOS. Place these files in "/usr/local/bin" and mark each executable using "chmod +x filename".
#Start tomcat
/Library/Tomcat/bin/startup.sh &>/dev/null &disown
#print message
printf "\n\nStarting apache tomcat\n"
#sleep for 5 seconds
sleep 5
#Check if tomcat has started (localhost:8080 should succeed)
<?php
class wordpress_pluing_information
{
// Variable to store plugin name
var $slug;
var $results;
function wordpress_pluing_information($aSlug)
{
// Set the pluignName of the new object to the argument
@f13dev
f13dev / getLinksFromTwitterText.php
Last active June 29, 2016 10:37
Converts a plain text Twitter tweet into html to <a> tags for URLs, #links and @links
<?php
/**
* Takes a string argument, which may include URLs, twitter #links or twitter @links,
* imbeds html <a> tags into the string and returns it.
*
* @param [type] $string [description]
* @return [type] $string [description]
*/
function getLinksFromTwitterText($string)
{