# app/lib/market_data_pull/tdameritrade/api_operation.rb
# Include this module inside of a class and then to use it, call
#
# perform_request { |client| client.<operation method> }
#
module MarketDataPull; module TDAmeritrade
module APIOperation
module_function
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 PdfMerger | |
def merge(pdf_paths, destination) | |
first_pdf_path = pdf_paths.delete_at(0) | |
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf| | |
pdf_paths.each do |pdf_path| | |
pdf.go_to_page(pdf.page_count) |
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
def positional_arguments(arg1, arg2, arg3) | |
puts [arg1, arg2, arg3].join(' ') | |
end | |
positional_arguments('Hello', 'Jean Luc', 'Picard') | |
def positional_with_hash(arg, opts = {}) | |
puts [arg, opts[:firstname], opts[:lastname]].join(' ') | |
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
FROM httpd:2.4.23 | |
# autoconf - needed for building debugger | |
# curl - useful tool for debugging in the container | |
# mysql-client - because we're using MySQL 5.7 on a different container | |
# libmysqlclient-dev - needed for mysql_config, option needed to get MYSQLI driver in compile | |
# gcc, make - need a C compiler to build PHP | |
# libxml2-dev - dependency for compiling PHP | |
RUN apt-get update && apt-get install -y \ | |
autoconf \ |
# docker-compose.yml
version: '3'
services:
web:
build: ./
command: 'rails server -b 0.0.0.0 -p 3000'
ports:
- 4000:3000
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 IndentUtil | |
INDENT_SIZE = 2 | |
def indent_chars(indent_level) | |
' ' * INDENT_SIZE * indent_level | |
end | |
end | |
class PrettifyObject | |
MAX_LINE_SIZE = 120 |
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
/ views/refinery/_header.html.slim | |
nav#logo.navbar.navbar-light.navbar-expand(itemtype = "http://schema.org/Organization") | |
= link_to(Refinery::Core.site_name, refinery.root_path, class: 'navbar-brand', itemprop: 'url') | |
= cache [I18n.locale, 'main_menu', @page, Refinery::Page.fast_menu.map(&:updated_at).max] do | |
= bootstrap_main_menu(refinery_menu_pages, self).to_html |
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
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
# the mechanics, not a real-world use case. | |
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
# extension that works for any named association. That's what I really wanted! | |
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
# == DEFINITIONS | |
# - A Taxi is a car for hire. A taxi has_many :passengers. | |
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
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
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
In your command-line run the following commands:
brew doctor
brew update
NewerOlder