Skip to content

Instantly share code, notes, and snippets.

@rowej83
rowej83 / scroll-track.js
Created February 20, 2019 21:15
How to check if item is scroll to on the screen
function scroll_item() {
var tracked_item = $(".list_item").last(); // grabs the last "item" with the class list_item
// $(window).outerHeight() is the height of the browser window
// tracked_item.offset().top is the vertical amount of pixels from(below) the top of the web page document
var scrollPosition = tracked_item.offset().top - $(window).outerHeight(); // figures out how many pixels below the
// initial browser window is the tracked item. So if the window is 700px vertically and the item that is being tracked
// is 1200px from the very top of the document.. then the user needs to scroll 500 more pixels to reach the
// tracked item.
@rowej83
rowej83 / disable-animation-on-mobile.css
Last active March 25, 2019 13:41
disable all animations on mobile
@media screen and (max-width: 768px) {
*, *:before, *:after {
/*CSS transitions*/
transition-property: none !important;
/*CSS transforms*/
transform: none !important;
/*CSS animations*/
animation: none !important;
}
}
@rowej83
rowej83 / visual-composer-breakpoints.css
Last active March 25, 2023 20:24
Visual Composer default breakpoints
@media (max-width:767px){
/* Phones */
}
@media (min-width:768px) and (max-width:991px){
/* small tablets */
}
@media (min-width:992px) and (max-width:1199px){
/* large tablets and desktop */
}
@media (min-width:1200px){
@rowej83
rowej83 / vue.config.js
Last active December 4, 2019 13:22
webpack 4 vue cli 3 - single js and css output with static name (app.js & app.css)
//const path = require('path');
const ExtractTextPlugin = require('mini-css-extract-plugin');
module.exports = {
configureWebpack:{ optimization:{
splitChunks:false
}},
chainWebpack: config => {
config.output
.filename('js/[name].js')
@rowej83
rowej83 / findoverflowingitem.css
Created April 20, 2018 17:43
Quick way to see what object is overflowing in css
* {
outline: 1px solid red !important
}
@rowej83
rowej83 / sub-blog-posts-select.php
Last active April 6, 2018 12:52
Wordpress + Element-UI Vuejs .. loads sub blogs posts in a el-tree
<?php
/*
Plugin Name: Popular Sub Blog Posts Selector
Plugin URI:
Description: Popular Sub Blog Posts Selector
Version: 1
Author: Jason Rowe
Author URI: https://www.idealwebdesign.net
License: GPL2
*/
@rowej83
rowej83 / view-only-your-posts.php
Last active December 5, 2017 17:45
WordPress Plugin so that client-event role users can only see their posts.
<?php
/*
Plugin Name: View only your posts
Description:Small plugin so that client-event users can only see their posts.
Author: Jason Rowe
*/
function posts_for_current_author($query) {
global $pagenow;
$tempuser = wp_get_current_user();
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*
*/
function optionsframework_option_name() {
@rowej83
rowej83 / extending_wp_rest_result.php
Last active April 25, 2017 13:53
Example of extending REST API for Wordpress to include a field not normally returned in result
/*
|--------------------------------------------------------------------------
| Prepare REST
|--------------------------------------------------------------------------
*/
function prepare_rest($data, $post, $request){
$_data = $data->data;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
@rowej83
rowej83 / breakpoints.css
Last active February 21, 2017 16:34
Mobile breakpoints including retina based off Bootstrap3 breakpoints
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),