Skip to content

Instantly share code, notes, and snippets.

View chendo's full-sized avatar

chendo chendo

View GitHub Profile
When /^I fill in "([^\"]*)" with:$/ do |field, string|
fill_in(field, :with => string)
end
Then /^I should not see a "([^\"]*)" button$/ do |button_name|
lambda {
When %Q{I press "#{button_name}"}
}.should raise_error(Capybara::ElementNotFound)
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Twitter</title>
<link rel="stylesheet" href="/stylesheets/main.css" type="text/css" media="screen" title="no title" charset="utf-8" />
</head>
<body>
window.Widget.Trending: class TrendingWidget extends Widget
constructor: (config) ->
Widget.Trending.instance: this
@template: """
<div class='widget small trending'>
<ul>
{{#topics}}
<li class='down'>{{name}}</li>
{{/topics}}
# Symbol to Proc is a mutha' fucking dirty hack. It brings the indirection
# that we hated from Pearl to Ruby. How it made it into core I don't know.
# Anyway, rather than bitch and moan too much, here is an alternative method
# which is much more expressive and has the same number of characters. The
# name pick comes from Rebol, though it functions more like select there.
# Benchmark:
# user system total real
# 0.200000 0.000000 0.200000 ( 0.212325)
# 0.470000 0.000000 0.470000 ( 0.475471)
# Rack::SimpleServer
#
# a small rack app that acts like a basic HTTP server
# github.com/chendo
#
# Options:
# * :root => directory to expose
# e.g., use Rack::SimpleServer, :root => 'pub'
module Rack
#!/bin/bash
# Disclaimer: my first bash script
# User purger - removes the user and their public keys from a system
# By chendo
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#!/bin/bash
read -p "Enter in part of public ssh key to search: " key
for f in `cut -d : -f 6 /etc/passwd`; do grep -nHs $key $f/.ssh/authorized_keys; done;
/* Instructions:
*
* Download to ~/.mailplane.css
* `defaults write com.mailplaneapp.Mailplane WebKitUserStyleSheetLocationPreferenceKey -string ~/.mailplane.css`
* `defaults write com.mailplaneapp.Mailplane WebKitUserStyleSheetEnabledPreferenceKey -bool true`
*
*/
body {
font-family: Helvetica; !important
@chendo
chendo / survey
Created November 2, 2009 01:02 — forked from radar/survey.md
What did you do to get good at Rails?
I just kept at it and worked with it on a professional basis. Constantly learning about new things and working with people who do Rails is also a good start.
Who taught you what you know?
The internet, friends/coworkers and Dr Nic. That, and trial and error. I guess one of the benefits of Rails is many things are implicit and make sense, but sometimes it has quirks and the internet documents a lot of these quirks.
Do you have any fond (or not so fond) memories of your learning experiences?
# Symbol#to_proc is already defined in Rails
class Symbol
def to_proc
Proc.new { |item| item.send self }
end
end
class Array
def to_proc
Proc.new do |item|