Skip to content

Instantly share code, notes, and snippets.

View simPod's full-sized avatar
💥
Trying to BC break your OSS

Simon Podlipsky simPod

💥
Trying to BC break your OSS
View GitHub Profile
@marijn
marijn / Example.php
Created April 3, 2012 16:53
An example on sorting Doctrine\Common\Collection\ArrayCollection elements
<?php
$collection = new Doctrine\Common\Collection\ArrayCollection();
// add objects to the collection that contain a getCreated method returning a DateTime instance
$iterator = $collection->getIterator();
$iterator->uasort(function ($first, $second) {
if ($first === $second) {
@NoobsArePeople2
NoobsArePeople2 / gist:5121597
Last active September 5, 2024 04:27
Configure media keys on a non-Apple keyboard to control Spotify via AppleScript and USB Overdrive on OSX.

Requirements

  1. USB Overdrive
  2. A non-Apple keyboard with media keys (or keys you want to make "media" keys). For reference, I'm using a Microsoft Sidewinder X4

Set Up

  1. Plug in your keyboard and install USB Overdrive.
  2. Open USB Overdrive. Click into the Settings tab.
  3. Click the dropdown and select "Any Keyboard, Any Application"
@mixin hover-focus-active() {
&:hover,
&:focus,
&:active { @content }
}
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@ueokande
ueokande / benchmark-commands.md
Last active November 6, 2024 19:48 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 16, 2024 05:10
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@den-crane
den-crane / CH-argMin-vs-Limit
Last active September 8, 2020 07:28
CH argMin vs Limit
create table test (p Int64, t Int64, x String, y Int64) engine=MergeTree order by (p,t)
insert into test select intDiv(number,10000), rand() r, toString(r), number from numbers(10000000);
select count(), min(x) from (
select * from test order by p, t limit 1 by p
)
┌─count()─┬─min(x)─┐
│ 1000 │ 100420 │
└─────────┴────────┘
@jiripudil
jiripudil / README.md
Created November 19, 2018 07:52
Running and compiling a PhpStorm plugin
  1. Open File | Project Structure.
  2. In Platform Settings | SDK, add an Intellij Platform Plugin SDK pointing to an installation of PhpStorm.
  3. In Project Settings | Libraries, add a Java library with two files from the installation of PhpStorm: plugins/php/lib/php.jar and plugins/php/lib/php-openapi.jar.
  4. In Project Settings | Modules, set the Module SDK to the SDK created in step 2.
  5. At the same place, add the library created in step 3 to the module if it's not there already. Then set its Scope to Provided and make sure the Export checkbox is unchecked.

Now you should be able to create a Plugin-type run configuration and run the plugin. To build a final jar file, use Build | Prepare Plugin Module For Deployment.

@nikolaposa
nikolaposa / rich_domain_model.php
Created August 19, 2019 07:56
Demonstrates the use of Method Injection technique to capture key bussiness logic in the entity itself.
<?php
declare(strict_types=1);
final class AnonymizeData
{
private $payload;
public function __construct(array $payload)
{
#!/usr/bin/env php
<?php
declare(strict_types=1);
namespace WaitForElasticsearch;
use InvalidArgumentException;
use UnexpectedValueException;
use function curl_close;