Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / mutation-types.js
Last active January 3, 2018 13:01
Mutation types for Vue Store
export const ALL_PRODUCTS = 'ALL_PRODUCTS';
export const ALL_PRODUCTS_SUCCESS = 'ALL_PRODUCTS_SUCCESS';
export const ALL_PRODUCTS_FAILURE = 'ALL_PRODUCTS_FAILURE';
export const PRODUCT_BY_ID = 'PRODUCT_BY_ID';
export const PRODUCT_BY_ID_SUCCESS = 'PRODUCT_BY_ID_SUCCESS';
export const ADD_PRODUCT = 'ADD_PRODUCT';
export const ADD_PRODUCT_SUCCESS = 'ADD_PRODUCT_SUCCESS';
export const ADD_PRODUCT_FAILURE = 'ADD_PRODUCT_FAILURE';
@jasperf
jasperf / ProductForm.vue
Last active January 3, 2018 13:15
Product form fields for Vue store
<template>
<form @submit.prevent="saveProduct">
<div class="col-lg-5 col-md-5 col-sm-12 col-xs-12">
<div class="form-group">
<label>Name</label>
<input
type="text"
placeholder="Name"
v-model="model.name"
v-validate="'required'"
@jasperf
jasperf / New.vue
Last active January 3, 2018 13:15
new.vue for new products
<template>
<product-form @save-product="addProduct" :model="model" :manufacturers="manufacturers"></product-form>
</template>
<script>
import ProductForm from '../../components/product/ProductForm.vue'
export default {
data() {
return {
model: {},
@jasperf
jasperf / App.Vue
Created December 25, 2017 13:50
Vue Store App.vue file
<template>
<div id="app">
<nav>
<div class="container">
<ul class="nav__left">
<!-- Navigation Links -->
<li><router-link to="/">Home</router-link></li>
<li><router-link to="/admin">Admin</router-link></li>
<li><router-link to="/cart">Cart</router-link></li>
</ul>
@jasperf
jasperf / router-links.html
Last active December 25, 2017 13:51
Vue Router Links
@jasperf
jasperf / index.html
Created December 24, 2017 09:17
VueJS V Bind Example
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="root">
<!-- <button type="" v-bind:title="title">Hover over me</button> -->
<button :title="title">Hover over me</button>
</div>
@jasperf
jasperf / index.html
Created December 24, 2017 07:10
VueJS v-model example
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="root">
<input type="text" name="input" v-model="message">
<p>The value of the input is {{message}}</p>
@jasperf
jasperf / ll.sh
Created November 5, 2017 06:24
Creat ll on OSX to show all files including hidden dot files
alias ll='ls -lGaf'
nano ~/.bash_profile
source ~/.bash_profile
@jasperf
jasperf / archive-product.php
Created October 27, 2017 08:27
Ianua Archive Page
<?php get_template_part('templates/content', 'store');
/**
*
* https://roots.io/using-woocommerce-with-sage/
*
* woocommerce_before_main_content hook.
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
export default class JSONobject {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#Using_the_default_export
// If we want to export a single value or to have a fallback value for our module, we could use a default export
// using export we create a JavaScript ES6 Module which we can later on import
// The new "export default" standard is designed to interoperate with existing CommonJS and AMD modules.
// https://hacks.mozilla.org/2015/08/es6-in-depth-modules/
// JavaScript classes provide a much simpler and clearer syntax to create objects and deal with inheritance.
fillFromJSON(json) {
if (!json) return;