Skip to content

Instantly share code, notes, and snippets.

View DylanCodeCabin's full-sized avatar

Dylan Auty DylanCodeCabin

View GitHub Profile
@DylanCodeCabin
DylanCodeCabin / decode_html_entities.js
Created October 7, 2016 09:38
Decodes html entities back to normal html
function decodeHtmlEntities(str) {
console.log(str);
var special = {
"&lt;" : "<",
"&gt;" : ">",
"&quot;" : '"',
"&apos;" : "'",
"&#039;" : "'",
"&amp;" : "&",
"\\" : ""
@DylanCodeCabin
DylanCodeCabin / quick_post_no_curl.php
Created October 7, 2016 13:12
Make a simple post request without the use of curl
<?php
function quick_post_no_curl($url, $form_data){
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($form_data)
)
);
<?php
//This is a PHP comment - PHP code can be written inside of there tags
?>
<?php
//This is a PHP comment - PHP code can be written inside of there tags
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
//This is a PHP comment – PHP code can be written inside of there tags
?>
</body>
<?php
/*
* This is a PHP comment
* This code shows the current day on the site
* Enjoy
*/
?>
<?php
$username = “Bob”;
?>
<?php
$username = “Bob”; //String
$age = 32; //Integer
$male = true; //Boolean
?>
<?php
$colors = array(“Red”, “Green”, “Blue”); //Array
?>
<?php
$colors = array(); //Array
$colors[0] = “Red”; //Set index 0
$colors[1] = “Green”; //Set index 1
$colors[2] = “Blue”; //Set index 2
?>