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
| // add the filter to your application module | |
| angular.module('yourAppName', ['filters']); | |
| /** | |
| * Truncate Filter | |
| * @Param string | |
| * @Param int, default = 10 | |
| * @Param string, default = "..." | |
| * @return string | |
| */ |
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
| (function(XHR) { | |
| "use strict"; | |
| var stats = []; | |
| var timeoutId = null; | |
| var open = XHR.prototype.open; | |
| var send = XHR.prototype.send; | |
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
| require "timeout" | |
| module WaitSteps | |
| extend RSpec::Matchers::DSL | |
| matcher :become_true do | |
| match do |block| | |
| begin | |
| Timeout.timeout(Capybara.default_wait_time) do | |
| sleep(0.1) until value = block.call |
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
| # add this file capybara_wait_until.rb to your /test directory | |
| module Capybara | |
| class Session | |
| ## | |
| # | |
| # Retry executing the block until a truthy result is returned or the timeout time is exceeded | |
| # | |
| # @param [Integer] timeout The amount of seconds to retry executing the given block | |
| # |
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 | |
| # A quick and dirty implementation of an HTTP proxy server in Ruby | |
| # because I did not want to install anything. | |
| # | |
| # Copyright (C) 2009 Torsten Becker <torsten.becker@gmail.com> | |
| require 'socket' | |
| require 'uri' | |
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 gravatar_url(email,options = {}) | |
| require 'digest/md5' | |
| hash = Digest::MD5.hexdigest(email) | |
| url = "http://www.gravatar.com/avatar/#{hash}" | |
| options.each do |option| | |
| option == options.first ? url+="?" : url+="&" | |
| key = option[0].to_s | |
| value = option[1].to_s | |
| url+=key + "=" + value | |
| 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
| # add this file capybara_wait_until.rb to your /test directory | |
| module Capybara | |
| class Session | |
| ## | |
| # | |
| # Retry executing the block until a truthy result is returned or the timeout time is exceeded | |
| # | |
| # @param [Integer] timeout The amount of seconds to retry executing the given block | |
| # |
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
| /* | |
| * grunt | |
| * https://github.com/cowboy/grunt | |
| * | |
| * Copyright (c) 2012 "Cowboy" Ben Alman | |
| * Copyright (c) 2012 John K. Paul @johnkpaul | |
| * Licensed under the MIT license. | |
| * http://benalman.com/about/license/ | |
| */ |
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
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| "sync" | |
| "time" | |
| ) | |
| func main() { |
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
| ENV["RAILS_ENV"] ||= 'test' | |
| require File.expand_path("../../config/environment", __FILE__) | |
| require 'rspec/rails' | |
| require 'rspec/autorun' | |
| require 'capybara/rspec' | |
| require 'webmock/rspec' | |
| require 'factory_girl' | |
| require 'factory_girl_rails' | |
| Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} |