This file contains 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
# Date formats | |
Time::DATE_FORMATS.merge!( | |
:friendly_date => lambda {|d| "#{d.month}/#{d.mday}" }, # 4/25 (no leading zeroes) | |
:friendly_time => lambda {|t| | |
date = (t.at_midnight == Time.now.at_midnight) ? '' : "#{t.month}/#{t.mday}@" # 4/25@4PM on other days | |
"#{date}#{t.strftime('%I').to_i}#{t.strftime('%p')}" # 4PM on same day | |
}, | |
:year => "%Y", # 2008 | |
:month_year => "%b %Y", # Apr 2008 | |
:ampm_time => "%I:%M %p", # 04:15 PM |
This file contains 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
<?php | |
class CardValidation { | |
public $valid = false; | |
public $valid_cc; | |
public $valid_cc_type_pair; | |
public $valid_ccv_type_pair; | |
public $error; | |
public function validate($cc, $type = false, $ccv = false) { |
This file contains 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
require 'rails_helper' | |
RSpec.describe CrawledUrl, :type => :model do | |
describe ".persist_from" do | |
let(:url) { 'http://www.foo.bar.com/foo-bar#lorem?ipsum=dolor' } | |
let(:attributes) { ::Crawler::UrlParser.parse url } | |
subject { CrawledUrl.persist_from url } | |
context "when url already persisted" do |
This file contains 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
// usage: phantomjs async-phantom.js | |
var async = require('async'), | |
links = [ | |
"http://google.com", | |
"http://yahoo.com", | |
"http://duckduckgo.com", | |
"http://bing.com", | |
]; |