Skip to content

Instantly share code, notes, and snippets.

View Akii's full-sized avatar
🚀
To the Moon

Akii

🚀
To the Moon
View GitHub Profile
/**
* Authenticate a user (Check various conditions for the user that might invalidate its authentication, eg. password match, domain, IP, etc.)
*
* @param array $user Data of user.
*
* @return integer >= 200: User authenticated successfully.
* No more checking is needed by other auth services.
* >= 100: User not authenticated; this service is not responsible.
* Other auth services will be asked.
* > 0: User authenticated successfully.
@Akii
Akii / auto-hibernate.sh
Created December 25, 2014 17:27
Hibernates the computer after sleeping for a while (don't use this without an SSD for obvious reasons)
#!/bin/bash
# /usr/lib/systemd/system-sleep/auto-hibernate.sh
# Go to hibernate in 30 minutes
autohibernate=1800
if [ "$1" = "pre" ] && [ "$2" = "suspend" ]
then
# Suspending, set RTC wake alarm
rtcwake -m no -s $autohibernate
fi
<?php
interface Foo {
public function things(Bar $bar);
}
class Bar {}
class Baz extends Bar {}
class Möp implements Foo {
<!--
The following li tag needs the class 'active' if the route is within 'some.*'
-->
<li class="has-sub">
<a>
<b class="caret pull-right"></b>
<i class="fa fa-users"></i>
<span>Thins</span>
</a>
<ul class="sub-menu">
$messageMappingConf = $this->arguments['newMessage']->getPropertyMappingConfiguration(); // there should be a getArgument as well
//$messageMappingConf->allowProperties('examdate'); shouldn't be needed
$messageMappingConf->forProperty('examdate')->setTypeConverterOption(
'TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter',
\TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
'd/m/Y'
);
/**
* @var Reviewer
* @ORM\ManyToOne
*/
protected $reviewer;
class Author implements ValueObject {
/**
* @var string
*/
protected $memberId;
// constructor
/**
<table {{bind-attr class="tableClassNames"}}>
<thead>
<tr>
{{#each header in tableHeaders}}
{{#if header.sortKey}}
<th {{action "sortBy" header.sortKey}} {{bind-attr class="header.classNames header.sortKey:sorting"}}>{{header.title}}</th>
{{else}}
<th {{bind-attr class="header.classNames"}}>{{header.title}}</th>
{{/if}}
{{/each}}
/**
* @Flow\Scope("singleton")
*/
class ApiProductionExceptionHandler extends ProductionExceptionHandler {
/**
* Only sends the HTTP header
*
* @param \Exception $exception The exception
* @return void
$query->matching(
$query->logicalAnd(
$query->getConstraint(),
$yourOtherConstraints
)
)