Skip to content

Instantly share code, notes, and snippets.

@frostfire64
frostfire64 / Template.vue
Last active March 9, 2020 10:08
Vue 2 Typescript Composition Api file template
<template>
<div></div>
</template>
<script lang="ts">
import { createComponent, ref } from '@vue/composition-api';
const Template: object = createComponent({
name: 'Template',
setup() {
@frostfire64
frostfire64 / CSSDebugSnippets.css
Created September 5, 2019 06:54
Usefull snippets for css debugging.
# classic oneliner
* { border: 1px solid red }
# https://dev.to/gajus/my-favorite-css-hack-32g3
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@frostfire64
frostfire64 / array_flatten_recursive.php
Created July 29, 2019 08:29
Flatten an array recursively in PHP
<?php
// it is a navie implementation for utulity use in small array cases
function array_flatten_recursive($array) {
$result = [];
foreach ($array as $element) {
if (is_array($element)) {
$result = array_merge($result, array_flatten_recursive($element));
} else {
$result = array_merge($result, [ $element ]);
@frostfire64
frostfire64 / gist:628b7b61b8abe8aa4154165d8dcbbf5b
Last active June 14, 2019 08:52 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Zapraszamy Wkr&#xF3;tce</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@frostfire64
frostfire64 / formats.md
Last active May 17, 2019 09:54
Date formats Poland

Javascript

// MYSQL date-fns 2019-05-17 19:55:03
format(new Date(), 'YYYY-MM-DD HH:mm:ss'),
// 17.05.2019 19:55 date-fns
format(new Date(), 'DD.MM.YYYY HH:mm'),
// 19:55 date-fns
format(new Date(), 'HH:mm'),
// 17.05.2019 date-fns
format(new Date(), 'DD.MM.YYYY'),