Skip to content

Instantly share code, notes, and snippets.

View piotr-galas's full-sized avatar
😀

Piotr piotr-galas

😀
View GitHub Profile
require "pry"
require "csv"
class GenerateCsvSummary
NUMBER_OF_ROWS = 10
GENERATED_FILE_PATH = "./csv_summary.csv"
def initialize(absolute_directory_path)
@absolute_directory_path = absolute_directory_path
end
class A{
saveArea(callback){
const {t} = this.props;
new Api('/nurses/area').post(this.prepareData())
.then(response => {
if(response.status === 200){
response.json().then(json => {
this.setState({
popupTitle: t('area.success.title'),
require 'pry'
# TASK: Implement this class to make tests pass
class BaseClass
attr_reader :errors
VALIDATORS = %i[presence_of_validator numericality_validator].freeze
def self.validates_presence_of(name)
@presence_of_attr = name
end
THREADS_NUM.times.map {
Thread.new do
while !@objects.empty?
object = @objects.pop
@mutex.synchronize do
print "#{Time.now.strftime("%H:%M")} - Saving data: #{@objects.length} items left. "
print "\r"
end
if object.save
@piotr-galas
piotr-galas / capistrano deploy from zero
Last active March 29, 2017 15:12
It shows steps to configure deploy with capistrano on almost empty server (OVH) ubuntu
# add key to authorized keys:
1. create file `.ssh/authorized_keys` on server, then on local machine:
`cat ~/.ssh/id_rsa.pub | ssh piotr@xxx.xxx.xxx.xx -p 5555 'cat >> .ssh/authorized_keys'`
2. Check if it possible to login without password
# base capistrano config
@piotr-galas
piotr-galas / .gitconfig
Last active March 8, 2017 07:41
dotfiles
[user]
name = Piotr
email = galaspiotrek@gmail.com
[push]
default = current
[color]
ui = auto
branch = auto
diff = auto
interactive = auto
class Validator
def self.presence(value, *fields)
puts value
puts fields
end
end
class Product
def self.validates(*params)
module Filters
class Arrays
initialize(filterad_array, pattern)
@filteredArray = filteredArray
@pattern = pattern
end
def fromPrimeCount
if validateInputs?
filtered
upstream action {
server unix:/srv/www/development/action-cable/tmp/sockets/puma.sock fail_timeout=0;
}
server {
server_name .actioncable.kulisz.eu;
keepalive_timeout 5;
root /srv/www/development/action-cable/public;
client_max_body_size 4G;
location / {
try_files $uri @action;
@piotr-galas
piotr-galas / preferences.sublime-settings
Created May 28, 2016 09:14
settings for sublime to dark theme with icons
{
"Seti_sidebar_font_size_14": true,
"Seti_tab_font_12": true,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"color_scheme": "Packages/User/SublimeLinter/Oceanic Next (SL).tmTheme",
"file_exclude_patterns":
[
"npm-debug.log"