Skip to content

Instantly share code, notes, and snippets.

View kulbida's full-sized avatar
🎯
Focusing

Bogdan Kulbida kulbida

🎯
Focusing
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')
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@ngauthier
ngauthier / settimeout.js
Created July 18, 2012 14:35
Daisy-Chaining setTimeout
// if we have
function do() {
// thing that takes 100ms - 2s depending on browser
}
// Instead of:
setInterval(do, 500) // pray it doesn't lock the browser
// Do this:
@dnagir
dnagir / readme.md
Created November 23, 2012 02:27
Unobtrusive and testable AJAX in Rails 3

The problem

Initially asked at RORO but I will elaborate with an example.

What we need to do is the following:

  • we list a set of items (let's say posts) and want to show a drop-down menu next to each one (quick example)
  • when the drop-down arrow is clicked the menu is loaded from the server.
@RunnerRick
RunnerRick / .sails-and-passport.md
Last active December 3, 2023 05:01 — forked from theangryangel/AuthController.js
How To Integrate Sails and Passport
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@rainerborene
rainerborene / ctrlp.vim
Last active November 22, 2017 13:52
Close buffer via <C-@> using CtrlP
let g:ctrlp_buffer_func = { 'enter': 'CtrlPMappings' }
function! CtrlPMappings()
nnoremap <buffer> <silent> <C-@> :call <sid>DeleteBuffer()<cr>
endfunction
function! s:DeleteBuffer()
let path = fnamemodify(getline('.')[2:], ':p')
let bufn = matchstr(path, '\v\d+\ze\*No Name')
exec "bd" bufn ==# "" ? path : bufn
@miguelmota
miguelmota / README.md
Last active March 16, 2024 12:52
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@ngauthier
ngauthier / merge.rb
Created June 25, 2014 14:39
ActiveRecord Scope Merging
# Merging Scopes
# ==============
# The goal is to join two tables to get all the records where a scope on both
# side of the join is used. I used to do this with a `where()` in which I
# added some sql on the joined table. But, I wanted to use the existing scopes
# from the joining table. Turns out there's a `merge` method on a scope where
# you can merge with another scope without having to chain!
class Car < ActiveRecord::Base
has_and_belongs_to_many :people
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do