The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
defmodule TravelerWeb.SearchbarLive do | |
use TravelerWeb, :live_view | |
alias Phoenix.LiveView.JS | |
alias Traveler.Places | |
def mount(_params, _session, socket) do | |
socket = assign(socket, places: []) | |
{:ok, socket, layout: false} | |
end |
-------------------------------------------------------------------------------- | |
JobPost.faster_search("ruby on rails").limit(10).explain | |
-------------------------------------------------------------------------------- | |
Limit (cost=32.64..40.68 rows=1 width=416) | |
-> Nested Loop (cost=32.64..40.68 rows=1 width=416) | |
-> HashAggregate (cost=32.36..32.37 rows=1 width=8) | |
Group Key: job_post_searches.job_post_id | |
-> Sort (cost=32.34..32.35 rows=1 width=752) | |
Sort Key: (ts_rank(job_post_searches_1.tsv_document, '''rubi'' & ''rail'''::tsquery, 0)), job_post_searches.job_post_id |
This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.
For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai
// ... | |
import ResponsiveWrapper from '../ResponsiveWrapper' | |
class Chart extends Component { | |
// ... | |
render() { | |
// ... | |
const svgDimensions = { | |
width: Math.max(this.props.parentWidth, 300), | |
height: 500 |
import React, { Component } from 'react' | |
export default ChartComponent => ( | |
class ResponsiveChart extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
containerWidth: null, | |
} |
// .... | |
import Bars from '../Bars' | |
// ... | |
export default class Chart extends Component { | |
//... | |
render() { | |
// ... | |
// .... | |
import Axes from '../Axes' | |
// ... | |
export default class Chart extends Component { | |
//... | |
render() { | |
// ... | |
// src/Chart/Chart.jsx | |
import React, { Component } from 'react' | |
import { scaleBand, scaleLinear } from 'd3-scale' | |
import data from '../../data' | |
export default class Chart extends Component { | |
constructor() { | |
super() |
import React from 'react' | |
import './App.css' | |
import Chart from '../Chart' | |
export default () => | |
<div className="App"> | |
<div className="App-header"> | |
<h2>Welcome to the</h2><h1>BAD ASS CHART</h1> | |
</div> |