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 / test.html
Last active August 29, 2015 14:27
document.ready
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Document.Ready?</title>
<script>
HTMLDocument.prototype.ready = function () {
return new Promise(function(resolve, reject) {
if (document.readyState === 'complete') {
resolve(document);
@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
@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 / .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 / code-16.png
Last active August 29, 2015 14:22
HTML5 WYSIWYG Editor
code-16.png
@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 / .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 / 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 / email.class.php
Last active May 16, 2018 04:54
PHP Email Class
<?php
/**
* Simple PHP mail class using mail()
*
* Strips, converts, etc. Automatically sets required headers. Takes most
* of the work out of the coding side of writing emails.
*
* You should verify that you have an email service installed.
* On Ubuntu, I use ssmtp (see link for manpage)
*