Skip to content

Instantly share code, notes, and snippets.

View harrygr's full-sized avatar

Harry harrygr

View GitHub Profile
@harrygr
harrygr / Laravel Blade: Bootstrap date input
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap date input
<div class="form-group {{ $errors->has(':name') ? 'has-error' : '' }}">
{{ Form::label(':name', ':label', ['class'=>'control-label']) }}
{{ Form::input('date', ':name', null, ['class'=>'form-control']) }}
{{ $errors->first(':name', '<span class="help-block">:message</span>') }}
</div>
@harrygr
harrygr / HTML: Boostrap tooltip
Created November 17, 2014 10:54
HTML: Boostrap tooltip
<span data-toggle="tooltip" data-placement="right" title=":text"><i class="fa fa-question-circle"></i></span>
@harrygr
harrygr / Laravel Blade: Bootstrap open form
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap open form
{{ Form::open(['route' => 'model.route', 'class' => '', 'method' => 'POST']) }}
<div class="row">
<!-- Form Fields -->
<div class="col-md-12">
{{ HTML::decode(HTML::linkRoute('model.index', '<i class="fa fa-chevron-left"></i> Back', null, ['class' => 'btn btn-default'])) }}
{{ Form::submit('Submit', ['class'=>'btn btn-success']) }}
</div>
</div>
{{ Form::close() }}
@harrygr
harrygr / Laravel Blade: Bootstrap form textarea
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap form textarea
<div class="form-group {{ $errors->has(':name') ? 'has-error' : '' }}">
{{ Form::label(':name', ':label', ['class'=>'control-label']) }}
{{ Form::textarea(':name', null, array('class'=>'form-control')) }}
{{ $errors->first(':name', '<span class="help-block">:message</span>') }}
</div>
@harrygr
harrygr / Laravel Blade: Bootstrap form checkbox
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap form checkbox
<div class="checkbox">
{{ Form::hidden($name, 0) }}
<label>
{{ Form::checkbox($name, 1) }} {{ $label }}
</label>
</div>
@harrygr
harrygr / Laravel Blade: Bootstrap form percent number input
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap form percent number input
{{ Form::label(':name', ':label', ['class'=>'control-label']) }}
<div class="form-group col-md-3 col-sm-3 col-xs-6 {{ $errors->has(':name') ? 'has-error' : '' }}">
<div class="input-group">
{{ Form::input('number', ':name', null, ['class'=>'form-control percent', 'step' => 'any']) }}
<span class="input-group-addon">%</span>
</div>
{{ $errors->first(':name', '<span class="help-block">:message</span>') }}
</div>
@harrygr
harrygr / Laravel Blade: Bootstrap edit form
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap edit form
{{ Form::model(':model', ['route' => ['model.update', $model->id], 'class' => '', 'method' => 'PUT']) }}
<div class="row">
<!-- Form Fields -->
<div class="col-md-12">
{{ HTML::decode(HTML::linkRoute('model.index', '<i class="fa fa-chevron-left"></i> Back', null, ['class' => 'btn btn-default'])) }}
{{ Form::submit('Update', ['class'=>'btn btn-success']) }}
</div>
</div>
{{ Form::close() }}
@harrygr
harrygr / Laravel Blade: Bootstrap form text input
Last active August 29, 2015 14:09
Laravel Blade: Bootstrap form text input
<div class="form-group {{ $errors->has(':name') ? 'has-error' : '' }}">
{{ Form::label(':name', ':label', ['class'=>'control-label']) }}<span class="required"></span>
{{ Form::text(':name', null, ['class'=>'form-control']) }}
{{ $errors->first(':name', '<span class="help-block">:message</span>') }}
</div>
@harrygr
harrygr / Laravel Blade: Bootstrap form select
Last active April 25, 2016 21:45
Laravel Blade: Bootstrap form select
<div class="form-group {{ $errors->has(':name') ? 'has-error' : '' }}">
{{ Form::label(':name', ':label', ['class'=>'control-label']) }}
{{ Form::select(':name', $options, $default, ['class'=>'form-control']) }}
{{ $errors->first(':name', '<span class="help-block">:message</span>') }}
</div>
@harrygr
harrygr / modified_dietz_return.php
Last active August 29, 2015 13:55
Modified Dietz Return
<?php
/**
* Calculates the Modified-Dietz return given arrays of MIMO
* MIMO is an associative array of dates to values
*
* @param DateTime $startDate Start date for return period
* @param DateTime $endDate End date for return period
* @param float $BMV Start value of the portfolio
* @param float $EMV End value of the portfolio
* @param array $MIMO A date-indexed associative array of the cash in/out of the portfolio