Skip to content

Instantly share code, notes, and snippets.

View shgysk8zer0's full-sized avatar
💭
I may be slow to respond.

Chris Zuber shgysk8zer0

💭
I may be slow to respond.
View GitHub Profile
@shgysk8zer0
shgysk8zer0 / weather.es6
Created August 26, 2015 07:58
OpenWeatherMap
/**
* Class for getting weather data using OpenWeatherMap
* @see http://openweathermap.org/current
*/
class OpenWeatherMap {
/**
* Creates new instance and sets class properties
*
* @param {string} imperial or metric
* @param {string} language code
@shgysk8zer0
shgysk8zer0 / pdo_connect.php
Created September 3, 2014 07:09
Extend PDO to connect via an object, array, or ini file. Adds methods to backup/restore database
<?php
/**
* Wrapper for standard PDO class.
*
* This class is meant only to be extended and
* not used directly. It offers only a protected
* __construct method and a public escape.
*
* @author Chris Zuber <shgysk8zer0@gmail.com>
* @copyright 2014, Chris Zuber
@shgysk8zer0
shgysk8zer0 / github.json
Last active August 29, 2015 14:10
PHP class and usage for GitHub Webooks
{
"secret": "Secret set when creating Web Hook"
}
@shgysk8zer0
shgysk8zer0 / green.svg
Last active August 29, 2015 14:11
SVG <symbol> concatontation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shgysk8zer0
shgysk8zer0 / .htaccess
Last active August 29, 2015 14:22
PHP SPL Autoloader
# Configure PHP's autoloader and set include_path
<IfModule env_module>
SetEnv AUTOLOAD_DIR classes
SetEnv AUTOLOAD_EXTS .php
SetEnv AUTOLOAD_FUNC spl_autoload
</IfModule>
# Loads the autoloader script before executing main PHP file
php_value auto_prepend_file ./autoloader.php
@shgysk8zer0
shgysk8zer0 / fetch_sample.js
Last active August 29, 2015 14:22
Example of using the new Headers, URL, FormData, & Request APIs along with fetch as a Promise
function submitForm(form) {
if (! ('fetch' in window)) {
return new Promise(function() {
throw new Error('Your browser does not support the fetch API');
});
}
var url = new URL(form.action || '/', document.baseURI || location.origin);
var headers = new Headers();
var body = new FormData(form);
headers.append('Content-Type', form.enctype || 'multipart/form-data');
@shgysk8zer0
shgysk8zer0 / code-16.png
Last active August 29, 2015 14:22
HTML5 WYSIWYG Editor
code-16.png
@shgysk8zer0
shgysk8zer0 / .gitattributes
Last active August 29, 2015 14:22
HTML Import Demo
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
@shgysk8zer0
shgysk8zer0 / .gitattributes
Last active August 29, 2015 14:22
SVG Use Demo
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
@shgysk8zer0
shgysk8zer0 / .htaccess
Last active August 29, 2015 14:26
TwitterAPI
DirectoryIndex index.html index.phtml index.php
#Configure PHP's autoloader and set include_path, min PHP version
<IfModule env_module>
SetEnv CONFIG_DIR ../../config
SetEnv AUTOLOAD_DIR ../../classes
</IfModule>
#Loads the autoloader script before executing main PHP file
php_value auto_prepend_file ../../std-php-functions/autoloader.php