Skip to content

Instantly share code, notes, and snippets.

View jsdecena's full-sized avatar
👑
Focusing

Jeff Decena jsdecena

👑
Focusing
View GitHub Profile
this.criteria.forEach(crit => {
this.form.responses.forEach(resp => {
if (resp.form_criteria_id === crit.form_criteria_id) {
return crit.value = resp.value;
}
});
});
console.log(this.criteria, '<<<');
@jsdecena
jsdecena / criteria-q-and-a.json
Last active October 23, 2018 02:29
QNA JSON
// Questions array:
const questions = [
{
"form_criteria_id":"46",
"field_name":"pumpstation_general",
"field_label":"General repairs required?",
"mandatory":false,
"action":"dropdown",
"input_type":[
{
@jsdecena
jsdecena / dynamic-for-loop.js
Last active October 16, 2018 04:52
How to conditional hide and show for Vue for loop
<template>
<section>
<div class="field" v-for="q in questions">
<div class="wrap" v-if="q.type === "q"">
<label>{{q.name}}</label>
<select @change="onChange($event)">
<option
:key="a.value"
:value="a.text"
v-for="a in q.answer">
$test = 'ACCOUNT_PERFORMANCE_REPORT (Sep 13, 2018-Sep 19, 2018)"\n
Account,Clicks,Impressions,CTR,Conversions,Conv. rate,Cost,Avg. position,Avg. CPC,Day\n
Massive Infinity,104,6115,1.70%,2.00,2.30%,79610000,1.2,765481,2018-09-17\n
Massive Infinity,16,716,2.23%,0.00,0.00%,116140000,2.7,7258750,2018-09-14\n
Massive Infinity,0,69,0.00%,0.00,0.00%,0,1.0,0,2018-09-15\n
Massive Infinity,86,8633,1.00%,0.00,0.00%,155350000,1.2,1806395,2018-09-18\n
Massive Infinity,91,7758,1.17%,1.00,1.28%,119260000,1.1,1310549,2018-09-19\n
Massive Infinity,5,699,0.72%,0.00,0.00%,44850000,2.7,8970000,2018-09-13\n
Massive Infinity,0,95,0.00%,0.00,0.00%,0,1.0,0,2018-09-16\n
Total,302,24085,1.25%,3.00,1.12%,515210000,1.3,1705993, --\n';
@jsdecena
jsdecena / user.service.js
Last active September 20, 2018 05:06
Service in Vue
import UserService from './user.service.js';
...
data() {
return {
users: []
}
},
mounted() {
loadUsers();
},
@jsdecena
jsdecena / index.vue
Last active September 19, 2018 12:12
External class in Vue
// Question: How can I extract the "DataTransformer" class and reference it back here?
// Solved!!!
<script>
// extract this in <root>/src/helpers/helper.js (or anywhere you want it)
export class DataTransformer {
static transform(data) {
const transformedData = {};
....
return transformedData
@jsdecena
jsdecena / Orders.php
Last active August 28, 2018 02:29
Filtering orders by query params in index method
/**
* @param array $params
*
* @param $orderBy
* @param $sortBy
*
* @return Collection
*
* Sample:
* `/orders?release_date_start=2018-01-01&release_date_end=2018-02-20&firm_id=3` OR
@jsdecena
jsdecena / readme.md
Created July 16, 2018 06:40
Base Repository Readme File

Base Repository Package

Install

  • Run in your terminal composer require jsdecena/baserepo

  • Add the base service provider in your config/app.php file like this:

    'providers' => [
@jsdecena
jsdecena / bitbucket-pipelines.yml
Last active July 9, 2018 05:18
Bitbucket pipeline file for running test programatically
image: node:6.9.4
pipelines:
branches:
master:
- step:
caches:
- node_modules
script:
- npm install
- npm run test --single-run
users
- id
- type (string)
user_user
- user_id_1
- user_id_2
User extends Model {
....