Skip to content

Instantly share code, notes, and snippets.

View calina-c's full-sized avatar

Călina Cenan calina-c

  • Kaolin Technologies
  • Cluj-Napoca, Romania
View GitHub Profile
DueDate:
type: date
properties:
attr:
class: datepicker
label_attr:
class: required
Type:
type: choice
properties:
<?php
namespace App\Forms\Entities;
use App\Forms\YamlConfigForm as Form;
use App\Models\Agency;
use App\Models\Service;
class ServiceForm extends Form
{
public function getModelClass()
<?php
namespace App\Forms;
use Kris\LaravelFormBuilder\Form;
use Yaml;
use Carbon\Carbon;
use App\Forms\Report\FormConfig;
use App\Forms\Entities\EntityFormConfig;
use App\Services\ReportServices\ReportStringProcessingTrait;
class Rule:
def matchesRule(self, number):
pass
def getReplacement(self):
pass
class FizzRule:
def matchesRule(self, number):
return not (number % 3);
class FizzRule:
def matchesRule(self, number):
return not (number % 3);
def getReplacement(self):
return "Fizz";
class BuzzRule:
def matchesRule(self, number):
return not (number % 5);
return $id ? "The item was updated." : "The item was created";
########
$action = $id ? "updated" : "created";
return sprintf("The item was %s.", $action).
return 'The number is ' + str(2) + '.'
return 'The number is %s.' % 2
return sprintf("%0.3f",$number);
return number_format($number, 3, '.', '');
return sprintf(
“The user %s %s has a balance of $%f.”,
$firstName,
$lastName,
$balance
);
return "The user " . $firstName . " has a balance of $" . $balance . ".";
@calina-c
calina-c / if-inversion-untangled-function.php
Created October 19, 2016 07:13
Part of IF inversion examples, contains only the untangled version of the function
<?php
function validateApplicationUntangled($user) {
if($user->age<18) {
printf("Sorry, but the user %s is under 18\n", $user->name);
return false;
}
if($user->hasPreviousApplication && $user->previousApplicationApproved) {
printf("Sorry, but the user %s has a previously approved application\n", $user->name);
return false;