Skip to content

Instantly share code, notes, and snippets.

View andrewlaskey's full-sized avatar

Andrew Laskey andrewlaskey

View GitHub Profile
@andrewlaskey
andrewlaskey / BasicPlayerMove2D.cs
Created March 14, 2020 20:58
Basic 2D player controller with long jump for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
private Rigidbody2D rb;
private float moveInput;
public float speed;
@andrewlaskey
andrewlaskey / OxiSocialLogin.vue
Last active February 5, 2020 02:28
Oxi Social Login Nacelle Component
<template>
<div class="login">
<div
v-if="showIframe"
class="oxi_social_wrapper"
>
<iframe
id="social_login_frame"
:src="iframeSrc"
style="width:100%;max-width:100%;padding-top:0px;margin-bottom:5px;border:0px;height:240px;"
@andrewlaskey
andrewlaskey / sticky-blog.liquid
Last active December 17, 2018 17:55
Adding stick, featured articles to a Shopify blog
<div class="blog-main">
{% comment %} Get all the articles for the blog {% endcomment %}
{% assign all_articles = blog.articles %}
{% assign posts_per_page = section.settings.posts_per_page %}
{% assign feature_article_1 = articles[section.settings.feature_article_1] %}
{% comment %}
Start pagination as you normally would. This is to be sure the correct
page nav links show up without having to modify anything about them.
{% endcomment %}
@andrewlaskey
andrewlaskey / products.liquid
Last active March 3, 2016 06:01
Shopify Product List
<ul class="product-grid">
{% for product in collections.frontpage.products %}
<li class="product">
<a class="product-image" href="{{ product.url }}" title="{{ product.title }}">
<img src="{{ product.featured_image | product_img_url: "medium" }}" alt="{{ product.title }}" />
</a>
<div class="product-content">
<span class="product-price">{{ product.price | money }}</span>
<a class="product-title" href="{{ product.url }}" title="{{ product.title }}">{{ product.title }}</a>
<p>
@andrewlaskey
andrewlaskey / getqueryobj.js
Last active September 11, 2015 23:15
Turn query parameters from url in to object
function getQueryObj() {
var queryObj = {};
if (window.location.search.indexOf('?') > -1) {
var query = window.location.search.split(/\?/),
params = query[1].split("&"),
for (var i = 0; i < params.length; i++) {
var keyVal = params[i].split("=");
@andrewlaskey
andrewlaskey / write_to_log.php
Created May 22, 2015 17:39
Wordpress write to log function
<?php
if (!function_exists('write_log')) {
function write_log ( $log ) {
if ( true === WP_DEBUG ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
@andrewlaskey
andrewlaskey / functions.php
Created February 24, 2015 18:12
Adding ACF to columns in Wordpress
// ADD NEW COLUMNS
function custom_columns_head($columns) {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'custom_field_1' => 'Column Name',
'custom_field_2' => 'Column Name',
'date' => 'Date'
);
return $columns;
@andrewlaskey
andrewlaskey / functions.php
Created October 3, 2014 17:31
Add custom post type archive page to menu screen
<?php
//http://stackoverflow.com/questions/20879401/how-to-add-custom-post-type-archive-to-menu
add_action('admin_head-nav-menus.php', 'wpclean_add_metabox_menu_posttype_archive');
function wpclean_add_metabox_menu_posttype_archive() {
add_meta_box('wpclean-metabox-nav-menu-posttype', 'Custom Post Type Archives', 'wpclean_metabox_menu_posttype_archive', 'nav-menus', 'side', 'default');
}
@andrewlaskey
andrewlaskey / functions.php
Created June 5, 2014 18:55
Page Navigation within Wordpress WP_Query
<?php
function page_navi_in_query($query) {
$bignum = 999999999;
if ( $query->max_num_pages <= 1 )
return;
echo '<nav class="pagination">';
echo paginate_links( array(
'base' => str_replace( $bignum, '%#%', esc_url( get_pagenum_link($bignum) ) ),
'format' => '',
@andrewlaskey
andrewlaskey / functions.php
Created June 5, 2014 00:06
Remove Wordpress auto paragraph tags only on pages not posts
<?php
add_filter('the_content', 'specific_no_wpautop', 9);
function specific_no_wpautop($content) {
global $post;
if (is_page()) { // or whatever other condition you like
remove_filter( 'the_content', 'wpautop' );
return $content;
} else {
return $content;