Clone the source repository.
Run rails secret
to generate secret key and set SECRET_KEY_BASE
to the value later in ~/.profile
.
default: &default | |
adapter: sqlite3 | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
timeout: 5000 | |
encoding: utf8 | |
development: | |
primary: | |
<<: *default | |
database: db/development.sqlite3 |
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.
#!/bin/sh | |
# echo sudo apt update | |
# sudo apt install -y curl net-tools tmux vim | |
# SLACK_WEBHOOK_URL=https://yourslackwebhookurl | |
hs=`hostname` | |
down_message="$hs logger is not running, please check" | |
while true | |
do | |
if nc -zw1 google.com 443; then |
--require spec_helper |
# Dockerfile | |
FROM ruby:2.6.3 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client-11 graphviz &&\ | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | |
apt-get update && apt-get install -y nodejs yarn | |
RUN mkdir /app | |
WORKDIR /app | |
ADD Gemfile /app/Gemfile |
browser = Watir::Browser.new(:chrome, headless: true) | |
browser.goto(url) | |
doc = browser.element(css: 'html').wait_until(&:present?) | |
Nokogiri::HTML(doc.inner_html).css('html’) |
require 'rubygems' | |
Pry.commands.alias_command 'c', 'continue' | |
Pry.commands.alias_command 's', 'step' | |
Pry.commands.alias_command 'n', 'next' | |
Pry.config.editor = "nvim" | |
def pbcopy(input) | |
str = input.to_s | |
IO.popen('pbcopy', 'w') { |f| f << str } | |
str |
<?php | |
/**As part of a data processing pipeline, complete the implementation of the make_pipeline method: | |
- The method should accept a variable number of functions, and it should return a new function that accepts one parameter $arg. | |
- The returned function should call the first function in the make_pipeline with the parameter $arg, and call the second function with the result of the first function. | |
- The returned function should continue calling each function in the make_pipeline in order, following the same pattern, and return the value from the last function. | |
For example, Pipeline::make_pipeline(function($x) { return $x * 3; }, function($x) { return $x + 1; }, function($x) { return $x / 2; }) then calling the returned function with 3 should return 5. | |
**/ | |
class Pipeline | |
{ | |
public static function make_pipeline() |
<?php | |
/**A palindrome is a word that reads the same backward or forward. Write a function that checks if a given word is a palindrome. | |
* Character case should be ignored. For example, isPalindrome("Deleveled") should return true as character case should be ignored, resulting in "deleveled", which is a palindrome since it reads the same backward and forward. | |
**/ | |
class Palindrome | |
{ | |
public static function isPalindrome($word) | |
{ | |
$word = trim($word); | |
$word = strtolower($word); |