We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Let's generate User model and controller.
// I'm tired of extensions that automatically: | |
// - show welcome pages / walkthroughs | |
// - show release notes | |
// - send telemetry | |
// - recommend things | |
// | |
// This disables all of that stuff. | |
// If you have more config, leave a comment so I can add it!! | |
{ |
const axios = require('axios'); | |
async function getLocations() { | |
const locationsData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocation", { | |
"TypeId": 71, | |
"ZipCode": "10001", | |
"CityName": "", | |
"PreferredDay": 0 | |
}); | |
return locationsData.data; | |
} |
function interceptNetworkRequests(ee) { | |
const open = XMLHttpRequest.prototype.open; | |
const send = XMLHttpRequest.prototype.send; | |
const isRegularXHR = open.toString().indexOf('native code') !== -1; | |
// don't hijack if already hijacked - this will mess up with frameworks like Angular with zones | |
// we work if we load first there which we can. | |
if (isRegularXHR) { |
If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8
To use the new phx.new
project generator, you can install the archive with the following command:
$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs
:
// Add a 401 response interceptor | |
window.axios.interceptors.response.use(function (response) { | |
return response; | |
}, function (error) { | |
if (401 === error.response.status) { | |
swal({ | |
title: "Session Expired", | |
text: "Your session has expired. Would you like to be redirected to the login page?", | |
type: "warning", | |
showCancelButton: true, |
require 'delegate' | |
module SidekiqExt | |
# Use read-only database if :db option is :read_only, | |
# otherwise use the default connection. | |
# | |
# Example: | |
# | |
# class MyWorker | |
# include Sidekiq::Worker |
class SudokuSolver { | |
constructor(board) { | |
this.board = board; | |
} | |
solve() { | |
const index = this.board.indexOf('0'); | |
if (index === -1) return this.board; | |
for (let possibility = 1; possibility < 10; possibility++) { |
$ gem list --verbose -r | |
*** REMOTE GEMS *** | |
GET https://api.rubygems.org/latest_specs.4.8.gz | |
302 Moved Temporarily | |
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz | |
200 OK | |
^CERROR: Interrupted |