Skip to content

Instantly share code, notes, and snippets.

View mosinski's full-sized avatar
👨‍💻
Shipping Code... Day & Night 🚀

Miłosz Osiński mosinski

👨‍💻
Shipping Code... Day & Night 🚀
View GitHub Profile
@mosinski
mosinski / Coverage Badges
Last active May 14, 2024 10:57
Coverage Badges
Coverage Badges
coś takiego:
# frozen_string_literal: true
class Shop::Settings
ALL_TERMINAL_LOCKERS_OPEN_ENABLED = "ALL_TERMINAL_LOCKERS_OPEN_ENABLED"
API_GATEWAY_NAME = "api_gateway_name"
ASSISTANCE_ENABLED = "ASSISTANCE_ENABLED"
CHECK_IN_FREE_LOCKER_ENABLED = "CHECK_IN_FREE_LOCKER_ENABLED"
CHECK_IN_MAILER_ENABLED = "CHECK_IN_MAILER_ENABLED"
CUSTOMER_CAR_SERVICE_SMS_ENABLED = "CUSTOMER_CAR_SERVICE_SMS_ENABLED"
@mosinski
mosinski / Jenkins.md
Last active September 24, 2018 15:35
curl -u Jenkins:Jenkins -H "Content-Type: application/json" -X POST http://localhost:7990/rest/build-status/1.0/commits/$GIT_COMMIT -d '{"state":"INPROGRESS","key": "'$BUILD_TAG'","name": "Jenkins-'$BUILD_DISPLAY_NAME'", "url": "'$BUILD_URL'/consoleText","description": "Changes by '$GIT_COMMITTER_EMAIL'"}'

#!/bin/sh
cd ${WORKSPACE}
SUCCESS=true

gem install bundler --no-rdoc --no-ri || SUCCESS=false
bundle install || SUCCESS=false
bundle exec rake db:create || SUCCESS=false
$cropper_width = $data['additional_product_information']['cropper_width'];
$cropper_height = $data['additional_product_information']['cropper_height'];
$cropper_x = $data['additional_product_information']['cropper_x'];
$cropper_y = $data['additional_product_information']['cropper_y'];
$filename = $data['additional_product_information']['thumbnail_url'];
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename='.$src);
$image = imagecreatefromjpeg($filename);
$crop = imagecreatetruecolor($cropper_width,$cropper_height);
imagecopy ( $crop, $image, 0, 0, $cropper_x, $cropper_y, $cropper_width, $cropper_height );
def index
puts '!!!!!!'
if current_user.sportsman?
@time_range = Date.today.at_beginning_of_month-6.days..Date.today.at_end_of_month+6.days
@trainings = Training.includes(:trainings_executions).where(start_date: @time_range, trainings_executions: {sportsman_id: current_user.id}).order(:start_time)
else
date = params[:start_date] ? params[:start_date].to_date : Date.today
@time_range = date.at_beginning_of_week..date.at_end_of_week
@training = Training.new
if current_user.coach?
@mosinski
mosinski / PG::Error: ERROR: new encoding (UTF8) is incompatible
Created October 10, 2015 16:20 — forked from amolkhanorkar/PG::Error: ERROR: new encoding (UTF8) is incompatible
Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
=================================================================================================================================
@mosinski
mosinski / only_numbers.js
Last active August 29, 2015 14:15
input allow only numbers
$(function() {
$('input[type=number]').keydown(function (e) {
var key = e.which || e.keyCode;
if (!e.shiftKey && !e.altKey && !e.ctrlKey &&
// numbers
key >= 48 && key <= 57 ||
// Numeric keypad
key >= 96 && key <= 105 ||
// comma, period and minus, . on keypad
puts "Podaj tekst:"
t = gets.chomp.split(//)
puts "Podaj wzorzec:"
p = gets.chomp.split(//)
n, m = t.length, p.length
pPos, iPos = 0, 0
while iPos < n
#!/usr/bin/ruby
require 'active_support/all'
@a = Array(1..ARGV[0].to_i)
def funkcja1(i)
if index = @a.index(i)
temp = @a.take(index).combination(2).to_a.delete_if { |a| a.sum != i }
@a.delete(i) if temp.empty?
puts "Funkcja1 i: #{i}"
@mosinski
mosinski / zad3
Last active August 29, 2015 14:08
def PERM(n)
puts "#{@my_array[1..-1].inspect}"
for i in 1..(1..n).inject(:*)
a = 0
loop do
if a > 1 && a < n+1
temp = @temp_array[a]
if a - temp > 1
@temp_array[a] = temp + 1;
@my_array[B(a,temp+1)], @my_array[a] = @my_array [a], @my_array[B(a,temp+1)]