Skip to content

Instantly share code, notes, and snippets.

View codenamev's full-sized avatar
🌩️

Valentino Stoll codenamev

🌩️
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@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')
# extract_fixtures.rake
# by Paul Schreiber <paulschreiber at gmail.com>
# 15 June 2010
#
# I got this from Peter Gulezian <http://metoca.net/>
# Looks like another version is here
# <http://redmine.rubyforge.org/svn/trunk/lib/tasks/extract_fixtures.rake>
#
# This is the inverse of the built-in rake db:fixtures:load
#
@petros
petros / CampfireIcons.txt
Created January 25, 2011 23:36
Campfire icons
:sunny:
:zap:
:leaves:
:lipstick:
:cop:
:wheelchair:
:fish:
:hammer:
:moneybag:
:calling:
@txus
txus / delegate_matcher.rb
Created February 2, 2011 09:19
RSpec matcher for delegations
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:month).to(:created_at) }
# it { should delegate(:year).to(:created_at) }
# end
@scottwb
scottwb / number_with_delimiter.js
Created February 11, 2011 04:10
Rails-like number_with_delimiter in javascript
Number.prototype.number_with_delimiter = function(delimiter) {
var number = this + '', delimiter = delimiter || ',';
var split = number.split('.');
split[0] = split[0].replace(
/(\d)(?=(\d\d\d)+(?!\d))/g,
'$1' + delimiter
);
return split.join('.');
};
@kylefiedler
kylefiedler / css.snippets
Last active November 7, 2019 16:42
Vim CSS Snippets
#Sass Snippets
snippet @i
@import "${1}";
snippet ext
@extend ${1};
snippet inc
@include ${1}(${2});${3}
snippet @m
@media ${1} {
${2}
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@chrisbloom7
chrisbloom7 / order_test_steps.rb
Created March 20, 2012 21:15
A cucumber/capybara step to test the order of elements in a list
Then /^I should see each item listed in alphabetical order in the items section$/ do
@items.each_with_index do |item, index|
find(:xpath, "//*[@id='items']/ul[@class='items']/li[#{index+1}]").inspect.should eq(find("li#item-#{item.friendly_id}").inspect)
@item = item
step "I should see the item listed in the items section"
end
end
Then /^I should( not)? see the item listed in the items section$/ do |negation|
assertion = negation ? :should_not : :should