Skip to content

Instantly share code, notes, and snippets.

View jsdecena's full-sized avatar
👑
Focusing

Jeff Decena jsdecena

👑
Focusing
View GitHub Profile
@jsdecena
jsdecena / recursion.php
Created February 27, 2020 03:26
recursion
// Result should be:
`Doe, John & Doe, Jane & Smith, James`
```
$array = [
'first_name' => 'John',
'last_name' => 'Doe,
],
[
'first_name' => 'James',
@jsdecena
jsdecena / create-all.js
Last active August 31, 2019 05:05
All Create js
<script>
import SystemInformation from './LandingPage/SystemInformation'
export default {
name: 'landing-page',
components: { SystemInformation },
data () {
return {
posts: [],
success: null
@jsdecena
jsdecena / all.js
Created August 31, 2019 05:03
All
<script>
import SystemInformation from './LandingPage/SystemInformation'
export default {
name: 'landing-page',
components: { SystemInformation },
data () {
return {
posts: [],
success: null
@jsdecena
jsdecena / delete.js
Created August 31, 2019 04:49
Update delete method
onDelete (id) {
this.posts.splice(id, 1)
localStorage.setItem('posts', JSON.stringify(this.posts))
this.success = 'Successfully deleted the post!' // add this message
}
...
<p v-if="success" class="alert alert-success">{{success}}</p>
<h2>Posts <router-link to="/post" class="btn btn-sm btn-primary">Add a post</router-link></h2>
<div v-if="posts.length" class="table-responsive">
...
@jsdecena
jsdecena / success.js
Created August 31, 2019 04:45
Success message JS
...
data () {
return {
posts: [],
success: null // here
}
},
@jsdecena
jsdecena / delete.js
Created August 31, 2019 04:42
Delete method JS
methods: {
....
onDelete (id) {
this.posts.splice(id, 1)
localStorage.setItem('posts', JSON.stringify(this.posts))
}
}
@jsdecena
jsdecena / delete.html
Created August 31, 2019 04:40
Delete a post
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Body</th>
<th></th>
</tr>
</thead>
<tbody>
@jsdecena
jsdecena / create.html
Created August 31, 2019 03:56
Post Create Vue template
<template>
<div id="main">
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Electron CMS</a>
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="#">Sign out</a>
</li>
</ul>
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'landing-page',