Skip to content

Instantly share code, notes, and snippets.

View ismailakbudak's full-sized avatar

Ismail Akbudak ismailakbudak

View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
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')
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@digitaljhelms
digitaljhelms / gist:4287848
Last active April 26, 2024 10:44
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@akiatoji
akiatoji / _sns_description
Last active January 15, 2020 02:30
AWS SNS Sample code.
Notes on how to use AWS SNS:
1. Subscribe an HTTP endpoint (i.e. http://myhost/sns_endpoint) on AWS Console
2. AWS will send subscription confirmation right away
3. SNS_controller responds to subscription confirmation by sending confirmation using Fog.
4. Once AWS is happy, you can start sending notifications to your end point via SNS.
@wrburgess
wrburgess / gist:5528649
Last active November 24, 2022 15:29
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@Integralist
Integralist / Ruby Lambdas.md
Last active August 8, 2023 05:10
Ruby lambdas

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!
@myronmarston
myronmarston / without_foreign_keys.rb
Created September 6, 2014 04:36
Example of how to disable foreign keys for a particular context
RSpec.shared_context "without foreign key constraints", :disable_foreign_keys do
def without_foreign_key_checks
DB.run('SET foreign_key_checks = 0;')
yield
ensure
DB.run('SET foreign_key_checks = 1;')
end
around(:example) { |ex| without_foreign_key_checks(&ex) }
end
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@emaraschio
emaraschio / SOLID.markdown
Last active May 24, 2023 07:18
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.