Skip to content

Instantly share code, notes, and snippets.

@cjlaborde
cjlaborde / postgres-cheatsheet.md
Created November 16, 2018 07:56 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
<div class="modal fade" id="new_calendar">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<%= form_for [@room, Calendar.new] do |f| %>
<div class="row">
<div class="col-md-6">
### Checks your account info.
git config --list
### Rename past Commits
1)git rebase --interactive HEAD~2
put reword in front of the commit you want to change name
2) another window again with the title of the commit you wrote reword in front
3) git push --force
php artisan make:model Foo -mcr
### Debug commands
php artisan package:discover
`php artisan route:clear`
`php artisan cache:clear`
`php artisan config:clear`
`php artisan view:clear`
### Switch PHP version in Linux.
sudo update-alternatives --config php
### Find php.ini file location
{{ print_r(php_ini_loaded_file()) }}
sudo code /etc/php/7.4/fpm/php.ini --user-data-dir
display_errors = Off"
phpinfo();
@cjlaborde
cjlaborde / gist:794b5d475eeb2689b36de9009646933e
Last active March 22, 2020 05:26 — forked from yesvods/gist:51af798dd1e7058625f4
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
Short Version
const mergedarray = [].concat(...yourArrays);

Async calls

<template>
<p v-if="isLoading">
  Loading...
  {{ myData.if.you.try.to.access.properties.here.it.will.error }}
</p>
<p v-else>
  {{ myData.you.can.access.properties.now.that.myData.is.loaded }}

Async calls

<template>
<p v-if="isLoading">
  Loading...
  {{ myData.if.you.try.to.access.properties.here.it.will.error }}
</p>
<p v-else>
  {{ myData.you.can.access.properties.now.that.myData.is.loaded }}
### File Limit
https://www.tecmint.com/limit-file-upload-size-in-nginx/
#### Set in http block which affects all server blocks (virtual hosts).
```
http {
...
client_max_body_size 100M;
}