Skip to content

Instantly share code, notes, and snippets.

View alex-cory's full-sized avatar
🔥
🤔

Alex Cory alex-cory

🔥
🤔
View GitHub Profile
@alex-cory
alex-cory / php server test #snippet
Created March 14, 2014 20:11
Tests to see what $_SERVER variables are working. If it Works then it displays: ☺ + output, Otherwise it displays: ⃠ Nada.. Zilch
// < ? php
// ——————————————————————————————————————————————————————————————————————————
# Just a PHP file to put on your local server (as I don't have enough memory)
$indicesServer = array('PHP_SELF',
'argv',
'argc',
'GATEWAY_INTERFACE',
'SERVER_ADDR',
'SERVER_NAME',
@alex-cory
alex-cory / php array #snippet
Created March 5, 2014 18:59
Just to make it quicker to create an array.
// Array with the Teacher class's data | $teacher is the class instantiated
$teacher_Data = #array(
[
'user_id' => $teacher->user_id,
'user_type' => $teacher->user_type,
'name' => $teacher->first_name . ' ' . $teacher->last_name,
'email_address' => $teacher->email_address
]; #);
@alex-cory
alex-cory / php error reporting #snippet
Created March 5, 2014 08:55
Turns the error reporting on for php.
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
@alex-cory
alex-cory / php log #snippet
Created March 5, 2014 07:44
This will show how many seconds it took to load
/**
* Write a line to a log file
*
* @param string $log destination of log file
* @param string $message message to log
* @return void
*/
function writeLog( $log , $message ) {
if (! file_exists( $log ) ) {
@alex-cory
alex-cory / php debug console #snippet
Created March 5, 2014 07:42
Great for debugging php when using the terminal. You can put little checks in where ever is necessary and easily find your debugging spots to remove them.
# ------------------------------------------------------------------
echo '--- check 1 ---------------------------------------' . "\n";
# DEBUG ------------------------------------------------------------
var_dump($something);
# ------------------------------------------------------------------
echo '---------------------------------------------------' . "\n";
# ------------------------------------------------------------------
@alex-cory
alex-cory / php autoloader #snippet
Last active August 29, 2015 13:56
Example autoloader. #snippet
function autoloader($class)
{
include_once 'classes/' . strtolower($class) . '.php';
}
spl_autoload_register(autoloader);
// http://goo.gl/8xmrcx
// http://goo.gl/bHXxrX
@alex-cory
alex-cory / 0_reuse_code.js
Created January 3, 2014 22:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console