Skip to content

Instantly share code, notes, and snippets.

View ludwiczakpawel's full-sized avatar

Paweł Ludwiczak ludwiczakpawel

View GitHub Profile
@tomas-stefano
tomas-stefano / Capybara.md
Last active February 5, 2026 20:28
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@patrys
patrys / jquery.placeholder.js
Created August 3, 2010 14:43
Fallback code for the HTML5 "placeholder" attribute
$(function() {
if (!('placeholder' in document.createElement('input'))) {
$('input[placeholder], textarea[placeholder]').each(function() {
var text = this.getAttribute('placeholder');
var fld = $(this);
function setPlaceholder() {
if (fld.val() == text || fld.val() == '') {
fld.addClass('jqPlaceholder');
fld.val(text);
@riddle
riddle / HTML5 placeholders
Created August 3, 2010 14:26
html5placeholder.js
enablePlaceholders: function() {
if (!('placeholder' in document.createElement('input'))) {
// enable <input placeholder> for browsers not drinking HTML5 kool-aid
$('input[placeholder]').each(function() {
var $this = $(this);
var placeholder = $this.attr('placeholder');
var insert_placeholder = function() {
if ($this.val() === '') {
$this.val(placeholder);