Skip to content

Instantly share code, notes, and snippets.

@ynarwal
ynarwal / postgres.md
Created October 24, 2021 01:55
restore data from postgres server to local docker container

A quick list of commands (in order) to use when we are trying to restore database from one environment to another.

> apt update

> apt-get install postgresql-client

> pg_dump -h <host> -p 5432 -U <username> -d <db> > db.sql

> copy db.sql in right container 
<% if @jobseeker and @job %>
<%= link_to "Ask for interview", {controller: "employers", action: "message_prompt", job_id: @job.id, seeker_id: @jobseeker.id}, id: "ask_for_interview", remote: true %> </div>
<%= form_for(:interview, :url => url_for(:controller => "employers", :action => "send_message"), :html => {:id => "interview_form" }) do |f| %>
<%= f.hidden_field :job_id, value: @job.id %>
<%= f.hidden_field :seeker_id, value: @jobseeker.id %>
<%= f.text_area :message %>
<button type="submit" class="btn btn-default">Submit</button>
<% end %>
<%end%>
<% if @search_type == "jobs" %>
<div class="row">
<div class="col-md-3">
<label for="city">City</label>
<select name="city" id="city" class="form-control">
<option value="any">Any</option>
<% (Job.uniq_with_column :city).each do |city| %>
<option value='<%=city %>'><%= city %></option>
<div class="content">
<% if @search_type == "comp_reviews" %>
<form method="get" action="/search">
<input type="hidden" name="search_from" value="refine_search" value='<%=session[:company]%>'></input>
<div class="row">
<div class="col-md-3">
<input type="text" name="company" placeholder="company" value='<%=session[:company]%>' class="form-control" />
</div>
<div class="col-md-3">
<div class="content">
<% if search_type == "interviews" %>
<form method="get" action="/search">
<input type="hidden" name="search_from" value="refine_search" value='<%=session[:company]%>'></input>
<div class="row">
<div class="col-md-3">
<input type="text" name="company" placeholder="company" value='<%=session[:company]%>' class="form-control" />
<!DOCTYPE html>
<html>
<head>
<title>Carousel Damn</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"> </script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="carousel">
.small_screen, .buttons{
display: none;
}
@media only screen and (max-width: 768px) {
li, img{
width: 30em;
<style>
.text{
text-align: center;
}
</style>
<div class="container">
<div class="text">
<h1>OUR SERVICES</h1>
Rails.application.routes.draw do
# get 'user_actions/search'
get 'jobs/:id/apply' => "jobs#apply"
post 'jobs/apply' => "jobs#create_application"
get '/search' => 'user_actions#search'
def power(s)
#cache the array list
array_length = s.length
#loop on the array
## initialize the super array
super_array = []
#add edge cases
super_array.push []