Skip to content

Instantly share code, notes, and snippets.

View adriandmitroca's full-sized avatar

Adrian Dmitroca adriandmitroca

View GitHub Profile
@adriandmitroca
adriandmitroca / mx-keys-remap.sh
Last active October 26, 2023 08:17
Fix right command / right alt on MX Keys not for Mac
# touch ~/mx-keys-remap.sh
#!/usr/bin/env bash
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x7000000e7,
"HIDKeyboardModifierMappingDst":0x7000000e6}]
}'
# chmod +x ~/mx-keys-remap.sh
@adriandmitroca
adriandmitroca / readme.md
Created August 3, 2021 15:58
How to update Supervisor config?
  1. vim /etc/supervisor/worker.conf
  2. Update config
  3. sudo supervisorctl reread
  4. sudo supervisorctl update
@adriandmitroca
adriandmitroca / .gitlab-ci.yml
Created July 19, 2021 11:30
GitLab CI Lint Check on Merge Requests
image: node:latest
cache:
paths:
- node_modules/
stages:
- lint
lint:
@adriandmitroca
adriandmitroca / svgo.config.js
Created July 17, 2021 16:45
Fix ViewBox removal in SVGO
const { extendDefaultPlugins } = require("svgo")
module.exports = {
plugins: extendDefaultPlugins([
{
name: "removeViewBox",
active: false,
},
]),
}
@adriandmitroca
adriandmitroca / config.yml
Last active February 20, 2020 10:32
CircleCI Deployment Recipe with assets building (Yarn with cache support) & git-ftp
version: 2
jobs:
build:
docker:
- image: circleci/php:7.2-node-browsers
working_directory: ~/repo
steps:
- checkout
@adriandmitroca
adriandmitroca / post-share.php
Last active February 17, 2020 13:43
WordPress - Social Share Example
<ul>
<li><a href="https://www.facebook.com/sharer/sharer.php?u=<?= rawurlencode(get_permalink()) ?>" target="_blank" rel="noopener noreferrer">Facebook</a></li>
<li><a href="https://twitter.com/intent/tweet?status=<?= rawurlencode(get_the_title() . ' ' . get_permalink()) ?>" target="_blank" rel="noopener noreferrer">Twitter</a></li>
<li><a href="mailto:?subject=<?= rawurlencode(get_the_title()) ?>&body=<?= rawurlencode(get_permalink()) ?>">Email</a></li>
</ul>
@adriandmitroca
adriandmitroca / Icon.vue
Last active July 6, 2020 15:46
SVGs in Vue.js loaded inline via HTTP with simple object cache. This is handy if you don't necessarily have single page app with full access to Webpack and want some quick and efficient way to use SVGs inline (eg. Laravel Mix). No 3rd party libraries or loaders required.
<template>
<html-fragment :html="icon" />
</template>
<script>
import axios from "axios"
export default {
props: {
name: String,
@adriandmitroca
adriandmitroca / app.js
Created July 17, 2019 12:30
Lottie, automatically fixing SVG scaling issue on Internet Explorer 11
const lottieIeFixer = (el, perspective = 'width') => {
if (!window.navigator.userAgent.includes('Windows') && !window.navigator.userAgent.includes('rv:11.0')) {
return;
}
const $el = $(el);
const width = $el.width();
const height = $el.height();
const $svg = $el.find('svg');
@adriandmitroca
adriandmitroca / app.js
Created December 18, 2018 11:33
Debounce done right in Vue.js
import debounce from 'lodash/debounce';
export default {
data() {
return {
loading: false,
query: null,
};
},
watch: {
@adriandmitroca
adriandmitroca / form-handler.php
Last active May 31, 2017 07:29
Snippet for quick contact form handling with vanilla PHP/JS + $.ajax
<?php
$subject = 'Temat wiadomości';
$recipient = 'recipient@example.com';
$output = [
'success' => 'Dziękujemy za wiadomość.',
'error' => 'Coś poszło nie tak. Spróbuj ponownie.',
];