Skip to content

Instantly share code, notes, and snippets.

View erwstout's full-sized avatar
🧨

Eric Stout erwstout

🧨
View GitHub Profile
@erwstout
erwstout / index.php
Created December 10, 2020 20:25
WordPress Logger
if (!function_exists('log_it')) {
function log_it($message)
{
if (WP_DEBUG === true) {
if (is_array($message) || is_object($message)) {
error_log(print_r($message, true));
} else {
error_log($message);
}
}
@erwstout
erwstout / WithStyles.ts
Created September 25, 2020 18:03
React-JSS HOC
import { createUseStyles, useTheme } from "react-jss";
import { WithStyles as WithStylesI, Theme } from "../../types";
export const WithStyles = ({ children, styles }: WithStylesI) => {
const useStyles = createUseStyles((theme: Theme) => styles(theme));
const theme = useTheme();
const classes = useStyles({ theme });
return children(classes);
};
@erwstout
erwstout / cloudSettings
Last active March 2, 2022 14:57
VSCode Settings
{"lastUpload":"2022-03-02T14:57:25.998Z","extensionVersion":"v3.4.3"}
@erwstout
erwstout / 01-Create-Repo-Server-Side
Created June 13, 2017 16:29
Deploy remote Git Repo
## - Create the repo on the server
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
@erwstout
erwstout / gulpfile.js
Created June 1, 2017 20:12
Gulpfile for ZOE
/*------------------------------------------------------------------------------
Gulpfile.js
------------------------------------------------------------------------------*/
// Theme information (name, starting theme version)
var theme = 'zoe',
version = '0.2.1';
// Set the paths you will be working with
var phpFiles = ['./**/*.php', './*.php'],
htmlFiles = ['./**/*.html', './*.html'],
@erwstout
erwstout / cache-json.php
Created November 15, 2016 15:41
Write JSON file and cache it.
<?php
/**
* Write an array to a JSON file. Replace $data with your array,
* and skip JSON encoding if you already have JSON
*/
function write_data_to_file( $filename ) {
$json = file_get_contents( 'http://path.to/external-site/file.json');
$time = time();
file_put_contents( $filename, $json );
}
@erwstout
erwstout / equalize.js
Last active May 17, 2016 21:28
Equalize Elements on load and window resize
var equalize = function() {
var max = Math.max.apply(null,
$('.equalize').css('height', 'auto').map(function() {
return $(this).outerHeight();
})
);
$('.equalize').outerHeight(max);
};
// equalize
@erwstout
erwstout / 0_reuse_code.js
Created February 2, 2016 16:26
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
@erwstout
erwstout / flexvideo.scss
Created January 25, 2016 18:34
Flex Video
// Flex Video Based on Zurb Foundation
.flex-video {
position: relative;
height: 0;
padding-bottom: 75%;
margin-bottom: 1rem;
overflow: hidden;
}
.flex-video iframe,
@erwstout
erwstout / gist:564021be25efb681997d
Last active February 9, 2016 17:29
Install Prelude Gulp Packages (Without Prelude)
npm install gulp jshint gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename gulp-imagemin imagemin-pngquant gulp-cssnano gulp-autoprefixer gulp-zip --save