We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
=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') |
# -*- encoding : utf-8 -*- | |
require 'spec_helper' | |
OmniAuth.config.test_mode = true | |
OmniAuth.config.add_mock(:facebook, {:uid => '123545', | |
:info => { :email => '[email protected]', | |
:first_name => "First", | |
:last_name => "Last"} | |
}) | |
OmniAuth.config.add_mock(:vkontakte, {:uid => '123545', |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
# this stuff goes in config/initializers/active_admin.rb | |
ActiveAdmin.setup do |config| | |
# ... | |
# put these lines in the "Controller Filters" section of the ActiveAdmin.setup block | |
# These two are defined in ActiveAdmin::FilterSaver::Controller, which is loaded below. | |
config.before_filter :restore_search_filters |
# app/controllers/sessions_controller.rb | |
class SessionsController < Devise::SessionsController | |
# This controller provides a JSON version of the Devise::SessionsController and | |
# is compatible with the use of SimpleTokenAuthentication. | |
# See https://github.com/gonzalo-bulnes/simple_token_authentication/issues/27 | |
def create | |
# Fetch params |
class ApiController < ApplicationController | |
# define which model will act as token authenticatable | |
acts_as_token_authentication_handler_for Login | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :null_session | |
respond_to :json | |
skip_before_filter :verify_authenticity_token, if: :json_request? |
require 'nokogumbo' | |
require 'uri' | |
def print_parents visited, path | |
parent = path | |
while parent = visited[parent] | |
puts "parent: %s" % URI.unescape(parent) | |
end | |
end |
module Reactor | |
class Task | |
property :block | |
def initialize(timestamp=Time.now, milliseconds=0, &block : Loop ->) | |
@block = block | |
@timestamp = timestamp.epoch_ms | |
@milliseconds = milliseconds | |
end | |
def run reactor |
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
This method does not add your OAuth token to Gemfile.lock
. It uses bundle config to store your credentials, and allows you to configure Heroku to use environment variables when deploying.