Skip to content

Instantly share code, notes, and snippets.

@hardlin3r
hardlin3r / puma.service
Created October 4, 2017 20:35 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@hardlin3r
hardlin3r / database_cleaner.rb
Created September 11, 2017 14:31 — forked from jsteiner/database_cleaner.rb
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
@hardlin3r
hardlin3r / active_record_enum_with_rails_admin.rb
Created September 5, 2017 19:38 — forked from dmilisic/active_record_enum_with_rails_admin.rb
Initializer for handling ActiveRecord (4.1+) enums by RailsAdmin (0.6.2)
module ActiveRecord
module RailsAdminEnum
def enum(definitions)
super
definitions.each do |name, values|
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a }
define_method("#{ name }=") do |value|
if value.kind_of?(String) and value.to_i.to_s == value
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
@hardlin3r
hardlin3r / octave.md
Created March 26, 2017 22:25 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &&
@hardlin3r
hardlin3r / Task.md
Created September 19, 2016 20:59 — forked from Evshved/Task.md
Taskforjob

Test task: “System for solving mathematical equations”.

The system should contain 2 main components: 1 Frontend server. 2 Backend server

1 Frontend server requirements

RoR application must provide: a) Selection of the type of equation (the default are linear and quadratic)