Skip to content

Instantly share code, notes, and snippets.

View leylaKapi's full-sized avatar
I may be slow to respond.

Leyla Kapi Kurtul leylaKapi

I may be slow to respond.
  • Hamburg / Germany
View GitHub Profile
leylaKapi /
Created February 22, 2021 14:09 — forked from syafiqfaiz/
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
leylaKapi / rails http status codes
Created September 24, 2019 16:21 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
leylaKapi /
Last active March 6, 2019 09:53 — forked from ceicke/
Downgrade PostgreSQL on Semaphore
#!/usr/bin/env bash -l
set -e
# Add the line below to your setup command in Project Settings
# wget && bash
# Note: reset your dependency cache in Project Settings > Admin, before running this script
leylaKapi / video-example.rb
Created May 2, 2018 08:35 — forked from arirusso/video-example.rb
ruby-processing: video processing example
#!/usr/bin/env ruby
# this is a test of ruby-processing ( with the video library
# use "rp5 unpack library" at a command line to install the video library, among others
# tested with Ruby 1.9.2
# video file:
class VideoTest < Processing::App
leylaKapi / rspec_model_testing_template.rb
Created March 14, 2018 10:12 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
leylaKapi / gist:cc0bd1e616a7cdf9e7aa8194fc87b18a
Created March 3, 2018 20:54 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup


:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
leylaKapi / capybara cheat sheet
Created March 1, 2018 11:38 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
leylaKapi / db.rake
Created December 27, 2017 11:38 — forked from bonkydog/db.rake
Fix 'ERROR: must be owner of extension plpgsql' complaints from Postgresql when dumping and reloading structure.sql
# Put this in your Rails app's lib/tasks directory
namespace :db do
desc "Fix 'ERROR: must be owner of extension plpgsql' complaints from Postgresql"
task :fix_psql_dump do |task|
filename = ENV['DB_STRUCTURE'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "structure.sql")
sql =
sql.sub!(/(CREATE EXTENSION IF NOT EXISTS plpgsql)/, '-- \1')
sql.sub!(/(COMMENT ON EXTENSION plpgsql)/, '-- \1'), 'w') do |f|
leylaKapi /
Last active November 24, 2017 09:16
Using FactoryGirl in Rails Console
$ RAILS_ENV=test rails c
[1] pry(main)> FactoryGirl.find_definitions
# then we can use each test row code in rails console
leylaKapi / your_model.rb
Created October 31, 2017 07:04
Rails pg jsonb column search method
# heading jsonb cloumn, and title a field inside jsonb search in jsonb
# heading: { title: "ABC" }
# For detail look at
q = "%#{search.downcase}%"
where("lower(heading ->> 'title') LIKE ?", q)