Skip to content

Instantly share code, notes, and snippets.

View nazzarkevich's full-sized avatar
:electron:
Build something people want

Naz nazzarkevich

:electron:
Build something people want
View GitHub Profile
class Item < ApplicationRecord
has_many :rentals, dependent: :destroy
validates_presence_of :title, :description
end
class Parse
require 'json'
def self.parse_json(file_name)
file = File.read(file_name)
if file.empty?
puts 'File is empty'
else
networks = JSON.parse(file).map { |var| var['unavailableNetworks'].map { |var| var['code'] } }
array = networks.flatten.uniq!
puts array
class Parse
require 'json'
def initialize
@networks = {}
@array = []
end
def parse_file file_name
file = File.read(file_name)
if file.empty?
@nazzarkevich
nazzarkevich / gist:9b4b59ffc7dd5b78f9fef97a4be2fcf5
Created September 18, 2017 18:34 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>