-
Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.
-
Reset PS3 controller by inserting paperclip into pinhole near L2 button.
-
Connect PS3 controller to Mac with USB cable.
-
Enable Bluetooth.
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
| # Filters added to this controller apply to all controllers in the application. | |
| # Likewise, all the methods added will be available for all controllers. | |
| # Make sure that all the methods that redirect are handled in the controllers. | |
| class ApplicationController < ActionController::Base | |
| include AuthenticatedSystem | |
| include Userstamp | |
| include ExceptionLoggable | |
| local_addresses.clear |
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 | |
| # frozen_string_literal: true | |
| require 'json' | |
| def files | |
| @files ||= begin | |
| `git diff --staged --name-only --cached`.split("\n").reject do |file| | |
| !File.exists?(file) | |
| end | |
| 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
| #!/usr/bin/env ruby | |
| require 'english' | |
| require 'rubocop' | |
| ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
| changed_files = `git status --porcelain`.split(/\n/). | |
| select { |file_name_with_status| | |
| file_name_with_status =~ ADDED_OR_MODIFIED |
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 'fileutils' | |
| require 'tempfile' | |
| # cn = '*.tb.local.vhost' | |
| # server_name = 'dev.tb.local.vhost' | |
| # admin_server_name = 'admin.tb.local.vhost' | |
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 | |
| # frozen_string_literal: true | |
| require 'net/http' | |
| require 'open-uri' | |
| require 'tempfile' | |
| require File.expand_path('ruby_bash', __dir__).to_s | |
| options = {} |
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 format_as_table(header, data) | |
| total_columns = data.first.size | |
| data.insert(0, header) if header | |
| column_widths = total_columns.times.map { |col| data.map { |row| row[col].size }.max } | |
| if header | |
| data.insert(1, Array.new(total_columns, '-').zip(column_widths).map { |a, b| a * b }) | |
| end | |
| data.map do |row| | |
| row.zip(column_widths).map do |cell, width| | |
| cell.to_s.ljust(width) |
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
| echo "Creating $(git rev-parse --git-dir)/hooks/pre-commit.d" | |
| mkdir $(git rev-parse --git-dir)/hooks/pre-commit.d | |
| echo "Downloading rubocop hook into $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
| wget -O $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop https://gist.githubusercontent.com/brand-it/93d04c839238283e3e756811b9c9cee0/raw/616bf812b58bcefc52d564ed8abacbf30966193c/pre-commit.d_rubocop | |
| echo "Changing rubocop into a executable $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
| chmod 755 $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop | |
| echo "adding hooks_directory variable to $(git rev-parse --git-dir)/hooks/pre-commit if it does not already exist" | |
| grep -qxF 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' $(git rev-parse --git-dir)/hooks/pre-commit || echo 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' >> $(git rev-parse --git-dir)/hooks/pre-commit | |
| echo "adding $hooks_directory/rubocop variable to $(git rev-parse --git-dir)/hooks/pre-commit if it do |
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
| # frozen_string_literal: true | |
| MAX_COLUMNS_FOR_TABLE = 15 unless defined?(MAX_COLUMNS_FOR_TABLE) | |
| DEFAULT_EDITOR = 'code' unless defined?(DEFAULT_EDITOR) | |
| class PrettyString < String | |
| # https://no-color.org/ | |
| NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 unless defined?(NO_COLOR) | |
| unless defined?(ANSI_COLORS) | |
| ANSI_COLORS = { | |
| red: 31, |
If you have your code defined in classes in lib/ folder you may have problems to load that code in production.
Autoloading is disabled in the production environment by default because of thread safety.
Change config/application.rb:
config.autoload_paths << Rails.root.join("lib")
config.eager_load_paths << Rails.root.join("lib")
OlderNewer