Skip to content

Instantly share code, notes, and snippets.

View johndavedecano's full-sized avatar
🏠
Working 🇳🇱

John Dave Decano johndavedecano

🏠
Working 🇳🇱
View GitHub Profile
#!/usr/bin/env bash
set -e
chown www-data:www-data -R /var/www/html/storage
chown www-data:www-data -R /var/www/html/bootstrap/cache
chmod 755 -R /var/www/html/storage
apt-get update
apt-get install -y \
git \
unzip \
zip \
curl \
nginx \
supervisor
@johndavedecano
johndavedecano / modal.svelte
Created September 20, 2020 11:07
Svelte Modal for Bootstrap 4
<script>
import { createEventDispatcher } from 'svelte'
const dispatch = createEventDispatcher()
export let open = false
export let title = ''
export let showHeader = true
@johndavedecano
johndavedecano / App.js
Created September 4, 2020 04:46
Mykel Aballe
import React, {useState} from 'react'
const TodoItem = ({index, data, onEdit, onEditing, onDelete, onToggle}) => (
<div style={{display:'flex',flexDirection:'row',justifyContent:'space-between',alignItems:'center'}}>
<div>
<input type="checkbox" onChange={() => onToggle(index)} />
{!data.is_editing ? <span style={{textDecoration:data.done ? 'line-through' : 'none'}}>{data.title}</span> : <input type='text' value={data.title} onChange={e => onEditing(index, e.target.value)} />}
</div>
<div>
import React from 'react'
import GridLayout from 'react-grid-layout'
import useStateWithCallback from 'use-state-with-callback'
function getLayout() {
try {
return JSON.parse(localStorage.getItem('layout'))
} catch (err) {
@johndavedecano
johndavedecano / .gitlab-ci.yml
Last active April 26, 2024 09:32
CI/CD for ReactJS Application using GITLAB
cache:
paths:
- node_modules/
- .yarn
stages:
- build
- test
- deploy
build:
image: node:10
@johndavedecano
johndavedecano / App.js
Created December 10, 2019 03:18
Using socket io with ReactJS
import React from 'react'
import { Provider } from 'react-redux'
import Root from './root'
import { SocketProvider } from './contexts/SocketContext'
const App = () => {
return (
<Provider store={store}>
export default [
{
loser: [
'attack_double',
'hit_ground',
'hit_fly',
'attack_normal',
'hit_fly',
'hit_ground',
'attack_double',
@johndavedecano
johndavedecano / awc-ecs-access-to-aws-efs.md
Created July 8, 2019 15:30 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:

@johndavedecano
johndavedecano / CORS CLoudfront
Last active March 7, 2019 17:39
Setup Laravel on Ubuntu 18.04
https://medium.com/@MicroPyramid/cors-with-amazon-s3-and-cloudfront-2792311c4b46
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>