Skip to content

Instantly share code, notes, and snippets.

View MatheusRich's full-sized avatar
🤔
Always learning, always changing

Matheus Richard MatheusRich

🤔
Always learning, always changing
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')
@technoweenie
technoweenie / parslet_test.rb
Created January 12, 2011 12:11
quick JSON example parser using parslet
require 'rubygems'
require 'parslet'
require 'pp'
def parse(klass, str)
parser = klass.new
puts "parsing #{str}"
pp parser.parse(str)
puts
rescue Parslet::ParseFailed => err
@testobsessed
testobsessed / capybara_helper.rb
Created March 1, 2011 01:37
Check if element is invisible with Capybara
def element_visible?(element_id)
# does the element exist?
exists = page.has_css?(element_id)
# is the element itself hidden with the .ui-helper-hidden class?
self_hidden = page.has_css?("#{element_id}.ui-helper-hidden")
# is the parent of the element hidden, thus hiding the element?
parent_hidden = page.has_css?(".ui-helper-hidden > #{element_id}")
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@danielestevez
danielestevez / gist:2044589
Last active June 30, 2024 09:04
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@marcelojunior
marcelojunior / gist:3708804
Created September 12, 2012 18:19
Inflections PT-BR Rails
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
@akoskovacs
akoskovacs / MyList.hs
Last active September 3, 2023 09:46
A simple Haskell linked list implementation
module MyList where
data MyList a = Cons a (MyList a)
| MyNil deriving (Show, Eq)
{-
A simple linked list module
Some examples:
mylist = (Cons 10 (Cons 99 (Cons 11 (Cons 1 MyNil))))
myHead myList # => 10
myTail myList # => Cons 99 (Cons 11 (Cons 1 MyNil))
@a1phanumeric
a1phanumeric / gist:5346170
Created April 9, 2013 14:35
Grep exclusions. Demonstrates how to exclude multiple directories, and files.
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
@joyrexus
joyrexus / README.md
Last active June 19, 2024 09:35 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})