Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View piotr-galas's full-sized avatar
😀

Piotr piotr-galas

😀
View GitHub Profile
@piotr-galas
piotr-galas / XmlSpliter.php
Created September 1, 2015 13:24
split xml to smaller one
<?php
class Lmnts_AdsImporter_Model_XmlSpliter
{
const ITEM_NUMBER = 6;
private $xmls = array();
public function splitAllFiles()
{
@piotr-galas
piotr-galas / payment.php
Last active October 6, 2015 07:22
wery bad code _postPayment
<?php
public function _postPayment( $data ) {
$app =JFactory::getApplication();
$html = "";
$get = $app->input->get->get('status', false);
if ( (bool) $get ) {
@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"
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;
module Filters
class Arrays
initialize(filterad_array, pattern)
@filteredArray = filteredArray
@pattern = pattern
end
def fromPrimeCount
if validateInputs?
filtered
class Validator
def self.presence(value, *fields)
puts value
puts fields
end
end
class Product
def self.validates(*params)
@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
@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
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
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