Skip to content

Instantly share code, notes, and snippets.


Bramus! bramus

View GitHub Profile
View changeValueInObject.js
const changeValueInObject = (object, key, value) => {
if (key.indexOf('.') !== -1) {
const keyParts = key.split('.');
const firstPartOfKey = keyParts.shift();
return {
[firstPartOfKey]: {
...(object[firstPartOfKey] ?? {}),
...changeValueInObject((object[firstPartOfKey] ?? {}), keyParts.join('.'), value),
bramus /
Created Mar 13, 2019
RE: Designing An Aspect Ratio Unit For CSS

The addition of an aspect-ratio property would indeed solve this specific issue. Glad to see it's being discussed (once wrote an extensive post on this myself).

Thinking further on this, this solution is somewhat limited: it only solves the aspect ratio problem.

A more broader solution could be the introduction of a val() function. It would work like the var() function – which reads the value of a custom property – but then for reading values from other properties. The function would yield the computed value of the given property. Combine it with calc() and you're good to go.

In code, it would result in something like this:

.box {
View multi-range-diff.php
// @ref
$a = range(5, 8);
$b = range(13,16);
$c = range(1,3);
$current = range(1,16);
bramus / isSunSup.php
Last active Nov 27, 2018
PHP: Is The Sun Up (standalone version)?
View isSunSup.php
function sunIsUp(\DateTime $when, $lat, $lon): bool {
$whenTimestamp = $when->getTimestamp();
$sunriseTimestamp = date_sunrise(
View gist:6f0de89d49d2f2ffc07e7662613a6a68
# wget
wget -m -p -E -k www.domain.tld
# httrack
httrack http://www.domain.tld +www.domain.tld/* --path './httrack' --verbose
View detox-bitrise.yml
format_version: 1.1.0
- push_branch: "*"
workflow: tests
- activate-ssh-key: {}
bramus /
Last active May 20, 2018
Fixing the XCode 9.x Simulator 3D/Map Performance issue

Got a slow/unresponsive Simulator with XCode 9.x?

You're most likely using some kind of 3D or Native Maps in your App then, no? Awaiting XCode 9.1 (which contains a fix) here's a workaround which replaces the bundled OpenGLES.framework with the version from XCode 9.0 beta 3.

Please do note …

⚠️ Installing frameworks/binaries from unfamiliar/untrusted resources always involves some risk. I can only say that I’ve been using the linked version without any issues. Your mileage may vary.


View config.json
"canvas": {
"width": 1200,
"height": 650
"backgrounds": [
"url": "",
"thumbnail_url": "",
"colors": {
bramus / StreamResponseFactory.php
Created Jan 6, 2017
Glide StreamResponseFactory
View StreamResponseFactory.php
use League\Flysystem\FilesystemInterface;
class StreamResponseFactory implements \League\Glide\Responses\ResponseFactoryInterface {
public function create(FilesystemInterface $cache, $path) {
return $cache->readStream($path);