Based on this blogpost.
Install with Homebrew:
$ brew install postgresql@14
(The version number 14
needs to be explicitly stated. The @
mark designates a version number is specified. If you need an older version of postgres, use postgresql@13
, for example.)
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).
This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)
- Installing Homebrew is effortless, open Terminal and enter :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
import React from 'react'; | |
function onlyChild(children) { | |
return Array.isArray(children) ? children[0] : children; | |
} | |
export function combineContext(contexts) { | |
class Provider extends React.Component { | |
render() { | |
const init = this.props.children; |
upload(files) { | |
const config = { | |
onUploadProgress: function(progressEvent) { | |
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) | |
console.log(percentCompleted) | |
} | |
} | |
let data = new FormData() | |
data.append('file', files[0]) |
I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.
Each file should be put in /usr/local/vesta/data/templates/web/apache2
Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html
import React from "react" | |
import { Route, Switch } from "react-router-dom" | |
const AppRoute = ({ component: Component, layout: Layout, ...rest }) => ( | |
<Route {...rest} render={props => ( | |
<Layout> | |
<Component {...props} /> | |
</Layout> | |
)} /> | |
) |
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
If you get error like this:
Running via Spring preloader in process 7662
/Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require': dlopen(/Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'