Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Wader;
final class Mbstring {
/**
* upcase first char in string
* @param string $str
* @return string
*/
<?php
function array_chunk_min($list,$minSize){
$cnt = count($list);
if($cnt <= $minSize){
return [$list];
}
$lastChunkSize = $cnt%$minSize;
if($lastChunkSize > 0){
$chunks = array_chunk(array_slice($list, 0, $cnt-$lastChunkSize),$minSize);
@Ambalus
Ambalus / build.sh
Last active August 4, 2016 11:32 — forked from ashumilova/build.sh
#!/bin/bash
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
@Ambalus
Ambalus / dcm4chee_install.sh
Last active August 10, 2017 15:47 — forked from gaelicWizard/dcm4chee_install.sh
bash script to install dcm4chee and components on fresh Ubuntu 12.04 image
#!/bin/bash
set -e
function usage()
{
echo "Usage: $0 -u <Postgres_Username> -p <Password>"
}
@Ambalus
Ambalus / dcm4chee.sh
Created August 6, 2016 17:12 — forked from edueo/dcm4chee.sh
Install dcm4chee
#!/bin/bash
mkdir -p /vagrant/dcm
cd /vagrant/dcm/
wget -O dcm4chee-2.17.3.zip 'http://downloads.sourceforge.net/project/dcm4che/dcm4chee/2.17.3/dcm4chee-2.17.3-mysql.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fdcm4che%2Ffiles%2Fdcm4 chee%2F2.17.3%2F&ts=1378999040&use_mirror=ufpr' &
wget -O dcm4che-2.0.23.zip 'http://downloads.sourceforge.net/project/dcm4che/dcm4che2/2.0.23/dcm4che-2.0.23-bin.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fdcm4che%2Ffiles%2Fdcm4che2 %2F2.0.23%2F&ts=1378999971&use_mirror=ufpr' &
wget -O jboss-4.2.3.zip 'http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjboss%2Ffiles%2FJBoss%2FJ Boss-4.2.3.GA%2F&ts=1378999423&use_mirror=ufpr' &
# wget -O dcmtk-3.6.0.zip 'ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/dcmtk-3.6.0.zip' &
wget -O oviyam-1.war 'https://dl.dropboxusercontent.com/u/28191834/proradis-config/programas/oviyam-1.war' &
wget -O oviyam2.war 'https://dl.dropboxu
<?php
$a = 4;
$b = 3;
$c = 5;
// a*a + b*b - c*c
// cosC = ---------------
// 2*a*b
function calculateAngle($c,$a,$b){
$angleInRadians=acos((pow($a,2) + pow($b,2) - pow($c,2)) / (2 * $a * $b));
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install mysql-server
mysql_secure_installation
# sudo apt-get install -y python-software-properties
# sudo add-apt-repository -y ppa:ondrej/php
# sudo apt-get update -y
apt-get install php7.1-cli php7.1-cgi php7.1-fpm php7.1-common php7.1-curl php7.1-gd \
<?php
$result = array();
//Создаем еще один массив с исходными данными
$pak = array();
$pak['Dima'] = 19;
$pak['Oleg'] = 32;
$pak['Maxim'] = 21;
$pak['Egor'] = 43;
<?php
class Core {
function parser(){
// for example: request Controller\User\
$controller = new Controller\User\UserController();
$action = '';
if (isset($_REQUEST['action'])) {
$action = strtolower($_REQUEST['action']);
}
<?php
$user_total = 230;
$expLevel = [0,28,56,84,112,140];
$level = getLevel($user_total,$expLevel);
print $level;
function getLevel($total,$list){
$sum = 0;
foreach($list as $level => $exp){