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
leylaKapi / how-to-copy-aws-rds-to-local.md
Created February 22, 2021 14:09 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
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
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
leylaKapi / pg-downgrade-semaphore.sh
Last active March 6, 2019 09:53 — forked from ceicke/pg-downgrade-semaphore.sh
Downgrade PostgreSQL on Semaphore
#!/usr/bin/env bash -l
set -e
###
# Add the line below to your setup command in Project Settings
#
# wget https://gist.githubusercontent.com/mimimalizam/27959bbc653de3965bb40955f4bc43df/raw/pg-downgrade-semaphore.sh && bash pg-downgrade-semaphore.sh
#
# Note: reset your dependency cache in Project Settings > Admin, before running this script
@leylaKapi
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 (https://github.com/jashkenas/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: http://bit.ly/H5yBjK
class VideoTest < Processing::App
@leylaKapi
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
leylaKapi / gist:cc0bd1e616a7cdf9e7aa8194fc87b18a
Created March 3, 2018 20:54 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

: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
leylaKapi / capybara cheat sheet
Created March 1, 2018 11:38 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@leylaKapi
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 = File.read(filename)
sql.sub!(/(CREATE EXTENSION IF NOT EXISTS plpgsql)/, '-- \1')
sql.sub!(/(COMMENT ON EXTENSION plpgsql)/, '-- \1')
File.open(filename, 'w') do |f|
f.write(sql)
@leylaKapi
leylaKapi / bash.sh
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
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 http://edgeguides.rubyonrails.org/active_record_postgresql.html#json-and-jsonb
def self.search(search)
q = "%#{search.downcase}%"
where("lower(heading ->> 'title') LIKE ?", q)
end