Skip to content

Instantly share code, notes, and snippets.

View etki's full-sized avatar
🤡
freaking out neighbor kids

Etki etki

🤡
freaking out neighbor kids
View GitHub Profile
var start = new Date().getTime(),
checkpoint = null,
delay = 1000,
end = start + (delay * 2),
current;
setTimeout(function () {
if ((current = new Date().getTime()) < end) {
console.log('we\'re borked');
} else {
@etki
etki / docker-compose.yml
Last active August 25, 2016 20:08
Quick and dirty dummy DNS SRV record setup
dnsmasq:
image: andyshinn/dnsmasq:2.76
ports:
- 10053:53/tcp
- 10053:53/udp
command:
- -W
- _http._tcp.router.lipe-routing.svc.cluster.local,pod-1,80
- -W
- _http._tcp.router.lipe-routing.svc.cluster.local,pod-2,80
@etki
etki / ffs.java
Created February 5, 2016 16:54
D:
CompletableFuture<Map<UUID, Collection<SuperCow>> method() {
CompletableFuture<Collection<SuperCow>> starter = callProvider();
return starter
.thenApply(c -> c.stream().collect(Collectors.groupingBy(SuperCow::getGroupingId))) // Map<UUID, List<SuperCow>>
.thenApply(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); // FFUUUUUUUUUU
}
if (stem.getAttributeA() != null) {
entity.setAttributeA(stem.getAttributeA());
}
if (stem.getAttributeB() != null) {
entity.setAttributeB(stem.getAttributeB());
}
if (stem.getAttributeC() != null) {
entity.setAttributeC(stem.getAttributeC());
}
if (stem.getAttributeD() != null) {
@etki
etki / WP_Form.php
Last active August 29, 2015 14:25
A loop for WordPress wp-forms plugin
<?php
class WP_Form implements WP_Form_Aggregate, WP_Form_Attributes_Interface
{
public function getElements()
{
$elements = [];
foreach ($this->elements as $element) {
$dataBuffer = $element->getAttributes();
if ($element instanceof WP_Form_Aggregate) {
$dataBuffer['elements'] = $element->getElements();
<?php
namespace AcmeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Site\RsrSecurityBundle\Service\RsrNwlSystem;
class ServiceController extends Controller
{
public function serviceRelatedAction()
@etki
etki / Application.php
Last active August 29, 2015 14:20
Interfaces
<?php
class Application
{
private $cache;
private $filesystem;
public function __construct(CacheInterface $cache, FilesystemInterface $filesystem)
{
$this->cache = $cache;
$this->filesystem = $filesystem;
@etki
etki / .gitignore
Created February 22, 2015 16:58
Test
/composer
/composer.phar
/composer.lock
/vendor
.idea
.project
.settings
nbproject
@etki
etki / gist:99da56773cacaadb7eac
Created January 17, 2015 21:50
Fake yii2-basic composer.json
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Application Template",
"keywords": ["yii2", "framework", "basic", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
@etki
etki / Output
Created November 22, 2014 19:46
Codeception separate processes issue
There was 1 error:
---------
1) SeparateProcessTest::testMe
PHPUnit_Framework_Exception: PHP Fatal error: Call to a member function run() on a non-object in /home/etki/Workspace/PHP/environment/vendor/codeception/codeception/src/Codeception/TestCase/Test.php on line 30
PHP Stack trace:
PHP 1. {main}() -:0
PHP 2. __phpunit_run_isolated_test() -:626
PHP 3. PHPUnit_Framework_TestCase->run() -:369
PHP 4. PHPUnit_Framework_TestResult->run() /home/etki/Workspace/PHP/environment/vendor/phpunit/phpunit/src/Framework/TestCase.php:711