This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application.put_env(:phoenix, :json_library, Jason) | |
Application.put_env(:sample, SamplePhoenix.Endpoint, | |
http: [ip: {127, 0, 0, 1}, port: 5001], | |
server: true, | |
live_view: [signing_salt: "aaaaaaaa"], | |
secret_key_base: String.duplicate("a", 64) | |
) | |
Mix.install([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ObservableGenServer do | |
defmacro __using__(opts) do | |
quote do | |
defmodule Server do | |
use GenServer | |
def start_link(n) do | |
GenServer.start_link(__MODULE__, n) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {createContext, useContext, useEffect, useRef, useState} from "react" | |
import { Socket } from "phoenix"; | |
const SocketContext = createContext({socket: null, connected: false}) | |
const useSocketCtx = ()=> useContext(SocketContext) | |
// this is what you would use in child components to get access to the socket | |
export const useSocket = ()=> { | |
const {socket} = useSocketCtx() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// do this first so we can locate deps | |
require("@babel/polyfill"); | |
require("@babel/register")({ cwd: __dirname }); | |
// This interface allows you to use console.log statements in server.js (which otherwise | |
// interfere with the readline interface that elixir-nodejs uses) | |
// | |
// node assets/cli | |
// output: | |
// { error: null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
QT_BASE_DIR=/opt/qt514 | |
export QTDIR=$QT_BASE_DIR | |
# add qt base to path | |
export PATH=$QT_BASE_DIR/bin:$PATH | |
# check arch | |
if [[ $(uname -m) == "x86_64" ]]; then |