This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_code | |
generated_code = nil | |
loop do | |
srand(Time.now.to_f) | |
chars = ("A".."Z").to_a + ("2".."9").to_a | |
generated_code = "" | |
1.upto(5) { |i| generated_code << chars[rand(chars.size - 1)] } | |
break if Lead.count(:conditions => {:code => generated_code}) == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_code | |
chars = ("A".."Z").to_a + ("2".."9").to_a # avoid ambiguity with 0/O and 1/I | |
generated_code = "" | |
1.upto(5) { |i| generated_code << chars[rand(chars.size - 1)] } | |
return generated_code | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Cart | |
In order to buy a sample | |
As a consumer | |
I want to add an item to my cart | |
Background: | |
Given the following products exist: | |
| sku | category | name | price | | |
| CPBOARD-001 | Cedar Pride | Sample Board | $15.00 | | |
| CPPANEL-013 | Cedar Pride | Wicker | $0.00 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pp' | |
require 'rubygems' | |
require 'mechanize' | |
require 'nokogiri' | |
PRICE_THRESHOLD = 200 | |
EMAIL_ALERT = '' # e-mail address to send alerts to | |
CELL_MAPPINGS = { | |
2 => 'ID', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :spec do | |
# largely lifted from http://www.pervasivecode.com/blog/2007/06/28/hacking-rakestats-to-get-gross-loc/ | |
task :stats_setup do | |
require 'code_statistics' | |
class CodeStatistics | |
alias calculate_statistics_orig calculate_statistics | |
def calculate_statistics | |
@pairs.inject({}) do |stats, pair| | |
if 3 == pair.size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# clistat | |
# Computer basic statistics from a run of curl benchmarks, it should probably be | |
# generalized to work from output from any cli app that gives numerical results | |
# one per line. | |
# | |
# Sample Usage and Output | |
# ----------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blob | |
mark :1 | |
data 1 | |
A | |
blob | |
mark :2 | |
data 1 | |
B | |
blob | |
mark :3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>OpenLayers Draggable DOM Element Example</title> | |
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> | |
<style type="text/css"> | |
#map { | |
width: 512px; | |
height: 320px; | |
border: 1px solid black; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. | |
Indeed. |