Skip to content

Instantly share code, notes, and snippets.

View jdltechworks's full-sized avatar

Jose Lo Jr. jdltechworks

View GitHub Profile
@jdltechworks
jdltechworks / App.js
Last active September 26, 2017 00:25
My react-redux setup
import React, { cloneElement, Component, Children } from 'react'
import { connect } from 'react-redux'
import omit from 'lodash/omit'
class App extends Component {
render() {
const { props } = this
const noform = omit(props, 'form')
return(
<div className="main">
@jdltechworks
jdltechworks / app.js
Last active September 25, 2017 08:22
import express from 'express'
import routes from './routes'
import bootstrap from './bootstrap'
const app = express()
bootstrap(app)
app.listen(3000, () => {
console.log('listening to port 3000')
<template>
<div class="regions container">
<div v-if="regions.length == 0" class="regions-group text-center">
<div class="loader-container">
<div class="loader">
<div class="ball-beat">
<div></div>
<div></div>
<div></div>
</div>
@jdltechworks
jdltechworks / image-loader-sample.js
Created October 19, 2017 05:31
Image loader sample
import React, { Component } from 'react'
export default class ShareThumbnail extends Component {
preloader(image) {
let { props } = this
let { src } = props
let loader = document.querySelector('.lazy-loader')
if( image !== null ) {
if( src ) {
image.style.display = 'none'
@jdltechworks
jdltechworks / mutation-types-generator.js
Last active May 31, 2018 09:47
mutation types with prefix
const createMutationTypes = (opts) => {
opts = opts || {};
let separator = opts.separator || '_'
if (typeof opts === 'string') {
opts = {prefix: opts}
}
const defineType = (obj, prefix, n, v) => {
v = v || [].concat.apply([], [prefix, n])
import axios from 'axios'
import authTypes from './mutation-types'
import loadingTypes from '~/store/modules/loader/types'
const types = authTypes(true)
const loading = loadingTypes()
export default {
Logout({ commit }) {
<?php
use Illuminate\Support\HtmlString;
if (! function_exists('react_assets')) {
function react_assets($path, $manifestDirectory = '') {
$manifestPath = public_path('assets-manifest.json');
$files = array_reverse(json_decode(file_get_contents($manifestPath), true));
{
"app.js": "http://localhost:3000/static/js/app.chunk.js",
"app.js.map": "http://localhost:3000/static/js/app.chunk.js.map",
"runtime-app.js": "http://localhost:3000/static/js/runtime-app.js",
"runtime-app.js.map": "http://localhost:3000/static/js/runtime-app.js.map",
"vendor.js": "http://localhost:3000/static/js/vendor.chunk.js",
"vendor.js.map": "http://localhost:3000/static/js/vendor.chunk.js.map"
}
<?php
namespace React;
class ReactBladeDirective {
/**
* Manifest file to read
*/
protected $manifest_files = '';
/**
* CRA generated assets
*/
@jdltechworks
jdltechworks / index.js
Created January 7, 2019 14:43
EntriesMultiplier
import React, { Component, Fragment } from "react";
type Props = {
multiplier: number,
setTotal: (total: number) => void,
};
type State = {
isVisible: boolean,
entries: number[] | null,