Skip to content

Instantly share code, notes, and snippets.

View galulex's full-sized avatar
🇺🇦
¯\_(ツ)_/¯

Alex Galushka galulex

🇺🇦
¯\_(ツ)_/¯
View GitHub Profile
@galulex
galulex / install.md
Last active February 28, 2021 14:15
Ruby On Rails Ubuntu 18.04 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev build-essential patch libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs rar

Ruby

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update

@galulex
galulex / zoom.js
Last active August 29, 2015 14:25
zoom
$(document).on('mousemove', '.zoom', function (e){
var rect = e.target.getBoundingClientRect(),
offsetX = e.clientX - rect.left,
offsetY = e.clientY - rect.top;
x = offsetX/this.offsetWidth*100
y = offsetY/this.offsetHeight*100
this.style.backgroundPosition = x + '% ' + y + '%';
})
@galulex
galulex / task.txt
Created April 15, 2017 10:47
Premium
Summary
We are a local home cleaning company called Homework. Today we are keeping track of all our bookings using a spreadsheet and we want to move it into a web application instead using Ruby on Rails. Our main goal with this project is to make it possible for customers to schedule a booking online. I've already created the scaffolding of the app for you and now I need you to add some functionality to it. This should take you about 1-2 hours, but you have up to 4 hours to complete it.
Deliverables
All models and columns should have validation as described in the model spec below.
Currently we operate in 10 cities, but plan to expand quickly. We need a way to store the list of cities we operate in and the ability to add to the list. You should create a new table to do this.
On the Cleaner Form we need a way to select the cities a cleaner works in. This should be a checkbox list populated by the list of cities we operate in. You may need to need to create a new table to store this data.
We need a way for cus
@galulex
galulex / example.js
Created August 22, 2018 09:46
React Code sample
import React, { Component } from 'react'
import {
Platform,
AsyncStorage,
Alert,
Modal,
TextInput,
TouchableOpacity,
Keyboard
} from 'react-native'
  • Introduction
  • Why ROR?
  • React/Redux
  • What do you like about React
  • What is Redux?

Ruby

  • What is a class?
  • What is the difference between a class and a module?
@galulex
galulex / sw.js
Created February 11, 2021 08:55
ServiceWorker.js
// This is the "Offline page" service worker
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
const CACHE = "pwabuilder-page";
// TODO: replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
const offlineFallbackPage = "offline.html";
self.addEventListener("message", (event) => {
@galulex
galulex / counties.js
Created March 13, 2023 15:00
US Counties
[
{
"value": "Autauga County",
"label": "Autauga County",
"state": "AL"
},
{
"value": "Baldwin County",
"label": "Baldwin County",
"state": "AL"
@galulex
galulex / Readme.md
Last active August 30, 2023 13:00
Neovide config

Installation

 git clone https://github.com/galulex/vim.git ~/.vim
 mkdir ~/.fonts
 cd ~/.fonts && curl -fLo DroidSansMonoForPowerlinePlusNerdFileTypes.otf https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Mono.otf?raw=true

 ln -s  ~/.vim/.vimrc ~/.vimrc
 sudo apt-get install ctags wmctrl fonts-powerline

M1 Mac

@galulex
galulex / feature.rb
Created September 13, 2023 06:28
Rspec/Cabybara samples
RSpec.feature 'Trip', type: :feature, js: true do
let!(:user) { create(:user) }
let!(:work) { FavoriteAddress.create(user: user, name: 'Work', location: '49.426269,32.05418899999995', address: 'Active Bridge') }
let!(:home) { FavoriteAddress.create(user: user, name: 'Home', location: '49.44546829999999,32.071774000000005', address: 'Haharina, 55') }
let!(:card) { create(:card, user: user) }
let!(:car) { create(:car) }
let!(:driver) { create(:driver, car: car) }
let!(:price) { Price.delete_all && Price.create }
let!(:prev_trip) { user.trips.create(status: 'finished') }
let(:trip) { Trip.last }