Skip to content

Instantly share code, notes, and snippets.

@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
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active April 16, 2024 03:40
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update

@pwenzel
pwenzel / akamai_cache_test.sh
Created May 16, 2012 14:06
Test Akamai Headers
# http://mesmor.com/2012/03/18/akamai-pragma-debug-headers/
alias akacurl='curl -v -s -o /dev/null -H "accept-encoding: gzip" -H "Pragma: akamai-x-get-cache-key" -H "Pragma: akamai-x-cache-on" -H "Pragma: akamai-x-cache-remote-on" -H "Pragma: akamai-x-get-true-cache-key" ';
akacurl http://example.com/akamai-test-object.html;
@Blackshawk
Blackshawk / blog - Switching to Homebrew.md
Created April 2, 2013 04:57
Switching from Macports to Homebrew and getting my development environment back.

I've been a MacPorts user for quite awhile now. There was nothing religious about the decision - on my first day of work I was handed a new Macbook Pro and proceeded to set up a development environment. Tried to, anyway. While I'd been an avid Mac user for most of my life I'd never actually used it for serious web development - I did some small work back in the 90's but that was the days of OS9 and it was all un-Unixy. Long story short: I was a newb at developing on OSX.

Being an Ubuntu user, I was pretty spoiled by apt-get. After about three mintues of trying to compile stuff myself I marched back into my boss's office and asked if there was a package manager for OSX. He directed me to the Mac Ports website and I left extremely relieved. I think I ran across Homebrew at some point but I never explored it further.

For about three months this was satisfactory. MacPorts works well enough but it has a habit of annoying you at certain intersections. The biggest problem, though, was that the rest of the wo

@munificent
munificent / gist:9749671
Last active June 23, 2022 04:04
You appear to be creating a new IDE...
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs: