Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Stout erwstout

View GitHub Profile
@erwstout
erwstout / index.php
Created Dec 10, 2020
WordPress Logger
View index.php
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);
}
}
View WithStyles.ts
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 Sep 15, 2021
VSCode Settings
View cloudSettings
{"lastUpload":"2021-09-15T16:45:25.085Z","extensionVersion":"v3.4.3"}
View 01-Create-Repo-Server-Side
## - Create the repo on the server
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
@erwstout
erwstout / gulpfile.js
Created Jun 1, 2017
Gulpfile for ZOE
View gulpfile.js
/*------------------------------------------------------------------------------
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 Nov 15, 2016
Write JSON file and cache it.
View cache-json.php
<?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
Equalize Elements on load and window resize
View equalize.js
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 Feb 2, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View flexvideo.scss
// 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 Feb 9, 2016
Install Prelude Gulp Packages (Without Prelude)
View gist:564021be25efb681997d
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