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
class HealthController < ApplicationController | |
def index | |
results = {:status => "ok"} | |
respond_to do |format| | |
format.html { render :status => 200, :html => "ok" and return } | |
format.json { render :status => 200, :json => results.to_json and return } | |
end | |
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
=begin | |
Ruby code that will flatten an array of nested arrays of integers (or whatever) | |
into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4]. | |
A tail recursion was adopted so the minimal amount of variables is added to the stack. | |
Usage examples: | |
ArrayTools.flatten([]) |
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 reverse_recursive(string) | |
return string if string.size <= 1 | |
tail = string[-1] | |
head = string[0...-1] | |
rest = reverse_recursive(head) | |
tail + rest |
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 divide(dividend, divisor) | |
quotient = 0 | |
while(dividend >= divisor) do | |
dividend = dividend - divisor | |
quotient = quotient + 1 | |
end | |
quotient | |
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
MariaDB [rails_logs_development]> alter table log_entries add column wizard_key int | |
-> ; | |
Query OK, 0 rows affected (0.22 sec) | |
Records: 0 Duplicates: 0 Warnings: 0 | |
MariaDB [rails_logs_development]> Ctrl-C -- exit! | |
Aborted | |
ScottiMac:rails_logs sjohnson$ bundle exec rails c | |
DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2. (called from <top (required)> at /Users/sjohnson/fuzzygroup/hyde/coding_tests/rails_logs/config/initializers/new_framework_defaults.rb:21) | |
Loading development environment (Rails 5.1.4) |
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
ruby -e 'loop { puts `ps -ef --sort=start_time`.split("\n").last(10) << "\n-----\n"; sleep 1; }' | |
root 25888 22481 0 18:03 ? 00:00:00 docker-containerd-shim be068eef4b51530beba2ef40ade7c179a38dd440660b5b262ca97589758efe0a /var/run/docker/libcontainerd/be068eef4b51530beba2ef40ade7c179a38dd440660b5b262ca97589758efe0a docker-runc | |
root 25906 25888 0 18:03 ? 00:00:00 /bin/sh -c cd workspace && eval $(ssh-agent) && ssh-add && (rbenv install $(cat .ruby-version) || rbenv version) && gem install bundler && rbenv rehash && bundle install && bundle exec cap $DEPLOY_ENV deploy --trace | |
root 25946 25906 0 18:03 ? 00:00:00 ssh-agent | |
root 26114 25906 4 18:03 ? 00:00:06 /root/.rbenv/versions/2.2.3/bin/cap staging deploy --trace | |
root 26144 3291 0 18:03 ? 00:00:00 sshd: jenkins [priv] | |
jenkins 26148 26144 0 18:03 ? 00:00:00 sshd: jenkins@pts/2 | |
jenkins 26149 26148 0 18:03 pts/2 00:00:00 -bash | |
jenkins 26240 26149 0 18:04 pts/2 |
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 'json' | |
require 'benchmark' | |
class BaseRuntime | |
def figlet | |
puts "starting service..." | |
end | |
end | |
class MainRuntime < BaseRuntime |
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
[git_status] | |
conflicted = "🏳" | |
ahead = "🏎💨" | |
behind = "😰" | |
diverged = "😵" | |
untracked = "🤷" | |
stashed = "📦" | |
#modified = "📝" | |
staged.value = "++" | |
staged.style = "green" |
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 'countries/iso3166' | |
class CreateCountries < ActiveRecord::Migration[6.0] | |
def change | |
create_table :countries do |t| | |
t.string :name, limit: 64 | |
t.string :name_it, limit: 64 | |
t.integer :region, limit: 1 | |
t.string :iso2, limit: 2 | |
t.string :phone_prefix, limit: 3 |
OlderNewer