Skip to content

Instantly share code, notes, and snippets.

@keatz55
keatz55 / index.ex
Last active April 12, 2021 17:49
LiveView Query Helper Module
defmodule ExampleWeb.ArticleLive.Index do
alias Example.{Articles, Tags}
alias ExampleWeb.{ArticleLive, ComponentLive, Query}
use ExampleWeb, :live_view
@impl true
def render(assigns) do
~L"""
<div class="container max-w-screen-md mx-auto pt-6">
@keatz55
keatz55 / Dockerfile
Created June 8, 2018 00:10
Node Js Dockerfile Example
FROM node
COPY package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /src/app && cp -a /tmp/node_modules /src/app/
WORKDIR /src/app
COPY . /src/app
RUN npm run build
@keatz55
keatz55 / deploy.js
Last active June 8, 2018 00:36
Example K8s Microservice Yamls
const request = require('request-promise');
const shell = require('shelljs');
const dotenv = require('dotenv');
const minimist = require('minimist');
const yaml = require('js-yaml');
const fs = require('fs');
const semver = require('semver');
const glob = require('glob');
const snakeCase = require('snake-case');
@keatz55
keatz55 / PostPreview.js
Last active May 31, 2018 07:52
Context API - Simple Session Example
import React from 'react';
import Paper from 'material-ui/Paper';
import withSession from '../hocs/withSession';
class PostPreview extends React.PureComponent {
render() {
const { session } = this.props;
return (
<Paper square elevation={1}>
@keatz55
keatz55 / Editor.js
Last active May 31, 2018 07:52
Context API - Simple Tree Structure Example
import React from 'react';
import Paper from '@material-ui/core/Paper';
import uuidv4 from 'uuid/v4';
import TreeContext from './contexts/TreeContext';
import Node from './components/Node';
import NodeEditor from './components/NodeEditor';
class Editor extends React.Component {