Skip to content

Instantly share code, notes, and snippets.

View MightyPork's full-sized avatar
🐶
meow

Ondřej Hruška MightyPork

🐶
meow
View GitHub Profile
"use strict";
(function(m) {
m.FLOAT_THRESH = 0.0001;
m.E24 = [10,11,12,13,15,16,18,20,22,24,27,30,33,36,39,43,47,51,56,62,68,75,82,91];
m.E12 = evenVals(m.E24);
m.E6 = evenVals(m.E12);
m.E192 = [
.yearsep {
margin: dist(-2) 0;
position:relative;
text-align: center;
height: 2em;
display: flex;
justify-content: center; align-items: center;
&:after {
position: absolute;
@MightyPork
MightyPork / laravel-dd-autoexpand.php
Last active March 26, 2019 02:55
Automatically expand your dd()
<?php
// PUT THIS IN bootstrap/autoload.php (at the end)
/** auto-expand DD */
function dd()
{
array_map(function ($x) {
(new Illuminate\Support\Debug\Dumper)->dump($x);
}, func_get_args());
@MightyPork
MightyPork / usb_hid_keys.h
Last active March 20, 2026 10:23
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
$(function () {
// milliseconds
var RED_BUTTON_TIME = 60000; // time between pushing thbe red button
var CLICK_SEQ_TIME = 15000; // Time between refreshing the nearby area by clicking
var CLICK_TIME = 1000; // time between individual clicks
// Put your home coords here - this will be refreshed using the red button
// All coords are [Latitude, Longitude]
var home = [43.43696596521823, 14.677734375000002];
@MightyPork
MightyPork / bsre.md
Last active July 9, 2016 10:14
BSRE 2016 (W.I.P. blog post!)

IBM BSRE 2016

Intro

In early June 2016 I received a forwarded e-mail in the university inbox about the BSRE, which stands for Best Student Recognition Event. I didn't know at the time what it comprises nor that I'd end up participating myself. I'm also not a best student in any way.

A quick Google search yielded a lone blog post from one of the previous runs of the event, in France, which apparently focused on fighting food waste. It also boasted ominous keywords like "networking" and "teams", which however turned out not to be so bad.

In file included from /usr/include/c++/6.1.1/memory:81:0,
from ../3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtr.h:29,
from ../3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h:24,
from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:27,
from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
/usr/include/c++/6.1.1/bits/unique_ptr.h:49:28: note: declared here
template<typename> class auto_ptr;
^~~~~~~~
In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h:84:0,
from ../3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h:25,
--- src/gui/kernel/qclipboard_x11.cpp.orig 2016-05-30 18:49:49.000000000 +0200
+++ src/gui/kernel/qclipboard_x11.cpp 2016-05-30 18:52:03.301296814 +0200
@@ -943,7 +943,7 @@
XEvent event;
// waiting until the clipboard manager fetches the content.
- if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000, true)) {
+ if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 1000, true)) {
qWarning("QClipboard: Unable to receive an event from the "
"clipboard manager in a reasonable time");
/**
* @brief Configure SPI
*/
static void conf_spi(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2ENR_SPI1EN, ENABLE);
SPI_InitTypeDef spi_cnf;
SPI_StructInit(&spi_cnf);
<?php
class Lolwut {
const string = "I'm string";
const const = "I'm const";
const public = "I'm public";
const use = "I'm use";
const if = "I'm if";
//const class = "Class"; // this fails: