Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

leyla KAPİ leylaKapi

Block or report user

Report or block leylaKapi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@leylaKapi
leylaKapi / pg-downgrade-semaphore.sh
Last active Mar 6, 2019 — forked from ceicke/pg-downgrade-semaphore.sh
Downgrade PostgreSQL on Semaphore
View pg-downgrade-semaphore.sh
#!/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 — forked from arirusso/video-example.rb
ruby-processing: video processing example
View video-example.rb
#!/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 Mar 14, 2018 — forked from kyletcarlson/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…
View rspec_model_testing_template.rb
# 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 Mar 3, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:cc0bd1e616a7cdf9e7aa8194fc87b18a

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:
View 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 / conversions.rb
Last active Dec 28, 2017
Error while trying to load the gem 'devise. ActiveSupport: Duration can't be coerced into Integer - Fix upgrading ruby 2.4.2 version - Active Support lib file can be like below
View conversions.rb
require "active_support/core_ext/big_decimal/conversions"
require "active_support/number_helper"
require "active_support/core_ext/module/deprecation"
module ActiveSupport::NumericWithFormat
# Provides options for converting numbers into formatted strings.
# Options are provided for phone numbers, currency, percentage,
# precision, positional notation, file size and pretty printing.
#
# ==== Options
@leylaKapi
leylaKapi / db.rake
Created Dec 27, 2017 — forked from bonkydog/db.rake
Fix 'ERROR: must be owner of extension plpgsql' complaints from Postgresql when dumping and reloading structure.sql
View db.rake
# 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 Nov 24, 2017
Using FactoryGirl in Rails Console
View bash.sh
$ 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 Oct 31, 2017
Rails pg jsonb column search method
View your_model.rb
# 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
@leylaKapi
leylaKapi / index.html.erb
Created Oct 2, 2017
Select-tag add link
View index.html.erb
<%= select_tag 'team_id', options_from_collection_for_select(@teams, "id", "name") %>
<script>
$(function(){
$('#team_id').bind('change', function () {
var url = "/Teamleader/" + $(this).val()
if (url) {
window.location.replace(url);
}
return false;
You can’t perform that action at this time.