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
@Akii
Akii / getResources
Created February 3, 2014 19:50
How to iterate through images in the resource tab of the page.
lib.slideshow = COA
lib.slideshow {
10 = TEXT
10.data = levelmedia:-1, slide
10.split {
token=,
cObjNum=1
1 {
1 = IMG_RESOURCE
1 {
// SERVER_NAME is a defined constant
// Create dictionary of search parameters
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:(__bridge id)(kSecClassInternetPassword), kSecClass, SERVER_NAME, kSecAttrServer, kCFBooleanTrue, kSecReturnAttributes, nil];
// Remove any old values from the keychain
OSStatus err = SecItemDelete((__bridge CFDictionaryRef) dict);
// Create dictionary of parameters to add
NSData* passwordData = [credentials.password dataUsingEncoding:NSUTF8StringEncoding];
@Akii
Akii / setup.txt
Created May 20, 2014 11:34
Ajax Extbase
ajax_page = PAGE
ajax_page {
typeNum = 1400579457
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
additionalHeaders (
/**
* 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
/**