Skip to content

Instantly share code, notes, and snippets.

<?php
$db = new PDO('mysql:host=localhost;dbname=rmc2', 'root');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function benchmark($callback){
$start = microtime(true);
for ($i = 0; $i < 100; $i++)
$callback();
return microtime(true) - $start;
}
@kimaditiya
kimaditiya / percentil.sql
Created July 23, 2017 06:59 — forked from fabiancarlos/percentil.sql
Percentil mysql
select floor(20/100*(count(*))) as min, floor(80/100*(count(*))) as max
from produto
order by valor
limit min, max;
select min, max
from (SELECT valor, floor(20/100*(count(*))) as min, floor(80/100*(count(*))) as max FROM produto group by fornecedor_id) produto
order by valor
limit 0, 4;
// included script. For example js/gridViewProceedCheckBoxes.js
/**
* [proceedCheckBoxes description]
* @param {[type]} btnID [id of button]
* @param {[type]} gridID [id of GridView]
* @param {[type]} pjaxID [id of pjax-container]
* @param {[type]} emptyAlertText [text for alert "Nothing Checked"]
* @param {[type]} confirmAlertText [text for confirmation alert]
* @param {[type]} proceedURL [controller action ro proceed]
<?php
echo $form->field($model, 'posterImage')->widget(FileInput::classname(), [
'options' => [
'multiple' => true,
'accept' => 'image/*',
],
'pluginOptions' => [
'maxImageWidth' => 265,
'maxImageHeight' => 376,
'minImageWidth' => 265,
https://github.com/yii2mod/yii2-google-maps-markers
http://stackoverflow.com/questions/42107022/yii2-gridview-custom-search-textbox
http://stackoverflow.com/questions/42164542/yii2-display-selected-values-in-multiple-select-dropdown
@kimaditiya
kimaditiya / Ary
Created February 20, 2017 10:03 — forked from ptrnov/Ary
Catatan
// make a comma delimited list
$string = join(',', $array);
Or loop yourself:
$string = '';
foreach ($array as $key => $value) {
$string .= ",$value";
}
Definitation doc
* @author me
* @version 0.1
* @package application.components
* @param string $bar param description {@link DummyClassB}
* @return DummyClassA
* @var
* @inheritdoc =>
@throws NotFoundHttpException if the model cannot be found
/* Reset */
html,
body {
height: 100%;
}
body {
margin: 0;
padding: 0;