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
// We only need to import the modules necessary for initial render | |
import CoreLayout from '../layouts/CoreLayout/CoreLayout'; | |
import Home from './Home'; | |
import LoginRoute from './Login'; | |
import SignupRoute from './Signup'; | |
import DashboardRoute from './Secure/Dashboard'; | |
import LeadsRoute from './Secure/Leads'; | |
import NotFound from './NotFound'; | |
/* Note: Instead of using JSX, we recommend using react-router |
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.
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
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 |
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 'nokogumbo' | |
require 'uri' | |
def print_parents visited, path | |
parent = path | |
while parent = visited[parent] | |
puts "parent: %s" % URI.unescape(parent) | |
end | |
end |
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
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? |
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
# 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 |
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
# 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 |
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 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
# -*- 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', |
NewerOlder