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 10, 2024 15:08
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 / .vimrc
Last active January 3, 2016 05:39
Istalacja Pathogen:mkdir -p ~/.vim/autoloadmkdir -p ~/.vim/bundlecd ~/.vim/autoload curl -Sso ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
" Pathogen *******************************************************************
call pathogen#incubate()
call pathogen#helptags()
" General ********************************************************************
set nocompatible
set encoding=utf-8
set fileencodings=utf-8,latin2
" Autowrite current buffer on switch
[user]
email = mylosz@yahoo.pl
name = Miłosz Osiński
[alias]
br = branch
co = checkout
ci = commit
df = diff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@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