create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
# 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 |
=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') |
/** | |
* jQuery.support.cssProperty | |
* To verify that a CSS property is supported | |
* (or any of its browser-specific implementations) | |
* | |
* @param p css property name | |
* @param rp optional, if set to true, the css property name will be returned | |
* instead of a boolean support indicator | |
* @return {mixed} | |
* |
license: gpl-3.0 |
-- Add the new tsvector column | |
ALTER TABLE articles ADD COLUMN tsv tsvector; | |
-- Create a function that will generate a tsvector from text data found in both the | |
-- title and body columns, but give a higher relevancy rating 'A' to the title data | |
CREATE FUNCTION articles_generate_tsvector() RETURNS trigger AS $$ | |
begin | |
new.tsv := | |
setweight(to_tsvector('pg_catalog.english', coalesce(new.title,'')), 'A') || | |
setweight(to_tsvector('pg_catalog.english', coalesce(new.body,'')), 'B'); |
#!/usr/bin/env ruby | |
# From my blog post at http://www.postal-code.com/binarycode/2009/06/06/better-range-intersection-in-ruby/ | |
class Range | |
def intersection(other) | |
raise ArgumentError, 'value must be a Range' unless other.kind_of?(Range) | |
my_min, my_max = first, exclude_end? ? max : last | |
other_min, other_max = other.first, other.exclude_end? ? other.max : other.last |
# switch default editor for pry to sublime text | |
Pry.config.editor = "sublime" | |
# format prompt to be <Rails version>@<ruby version>(<object>)> | |
Pry.config.prompt = proc do |obj, level, _| | |
prompt = "\e[1;30m" | |
prompt << "#{Rails.version} @ " if defined?(Rails) | |
prompt << "#{RUBY_VERSION}" | |
"#{prompt} (#{obj})>\e[0m" | |
end |
package main | |
import "fmt" | |
// Very naive answer. | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
n := 0 | |
a := 0 |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.
I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.
This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.