Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonidas Arvanitis larvanitis

View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View shims-tiptap-extensions.d.ts
// see: https://gist.github.com/grindpride/e436290d359b6da878b320b8ebf33446
declare module 'tiptap-extensions' {
import { Extension, Node, Mark, Editor } from 'tiptap';
import { Plugin } from 'prosemirror-state';
export class Blockquote extends Node {}
export class BulletList extends Node {}
export class Code extends Node {}
@larvanitis
larvanitis / component-wrapper.js
Created Jun 2, 2020
Quasar Component Wrapper
View component-wrapper.js
import Vue from 'vue';
import {quasarInit} from './quasar';
// props are required if you want to be able to do `vm.$data.myProp = 'xyz'` later
export function createComponent(component, elementOrSelector, props = {}) {
const el = resolveElement(elementOrSelector);
let origHtml = el.innerHTML;
Vue.config.productionTip = false;
quasarInit();
@larvanitis
larvanitis / index.html
Created Jun 2, 2020
Quasar Component Outside Vue
View index.html
<!-- assuming you have placed this outside `dist` dir -->
<html>
<head>
<meta charset="utf-8">
<title>Quasar Component Demo</title>
<link rel="stylesheet" href="./dist/myComponent.css">
</head>
<body>
<div id="my-component-selector"></div>
View MaximizeElementHeight.js
/*
* Maximizes the height of an element, using flex laytout,
* by applying classes to the element and it's parents.
* Warning: It breaks a lot of layouts and it is not a substitute for proper,
* hand-crafted code. Also, it is not really tested!
*/
/** Shorthand for `toggleMaxHeightElem(..., isMaximize = true)` */
function maximizeElemHeight(elem, topParent = 'html') {
toggleMaxHeightElem(elem, topParent, true);
@larvanitis
larvanitis / howto.sh
Last active Sep 20, 2017
Encrypted file container
View howto.sh
#!/bin/sh
echo "Not a script..." >&2 && exit 1
# This is more or less a TL;DR; procedure to create and use an encrypted volume contained in a file instead of a physical drive/partition.
# The encryption options are set to sane (and IMHO secure) values. The device will be (un)locked using a password.
# The mounting is done manually by the root and all users can access the mounted filesystem.
################
# REQUIREMENTS #
@larvanitis
larvanitis / jquery.semantic-ui.d.ts
Created May 21, 2017
Custom SemanticUI typescript definitions
View jquery.semantic-ui.d.ts
// tslint:disable:max-file-line-count
declare namespace SemanticUI {
type JQuerySelectorOrElement = string | Element | JQuery;
type AnimationDuration = string | number; // '500ms'
type AnimationName = 'scale' | 'scale in' | 'scale out'
| 'fade' | 'fade up' | 'fade down' | 'fade left' | 'fade right'
| 'fade in' | 'fade up in' | 'fade down in' | 'fade left in' | 'fade right in'
View musictube-1.6 PKGBUILD
# Maintainer: Leonidas Arvanitis <l.arvanitis gmail com>
# Contributor: Marius Nestor <marius softpedia com>
pkgname=musictube
pkgver=1.6
pkgrel=1
pkgdesc="YouTube streaming music player"
arch=('x86_64')
url="http://flavio.tordini.org/musictube"
license=('Proprietary')
@larvanitis
larvanitis / stateChangeDebugging.js
Created Jun 23, 2015
Event logging for AngularJS $location and ui-router $state change.
View stateChangeDebugging.js
angular.module('myModule').run(function ($rootScope, $state) {
/* ENTRY EVENTS */
$rootScope.$on('$locationChangeStart', function (event, toUrl, fromUrl, toHistoryState, fromHistoryState) {
console.groupCollapsed('$locationChangeStart');
console.debug('event:', event);
console.debug('toUrl:', toUrl);
console.debug('fromUrl:', fromUrl);
console.debug('toHistoryState:', toHistoryState);
@larvanitis
larvanitis / Yeoman-ng_gen.xml
Last active Dec 17, 2015
Webstorm / IDEA :: External Tools :: Yeoman angular:* generators (w/o --coffee or --minsafe) Installation: drop in ~/.WebStorm6/config/tools/
View Yeoman-ng_gen.xml
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Yeoman[ng]">
<tool name="Create Route" description="Generates a controller and view, and configures a route in app/scripts/app.js connecting them." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="yo" />
<option name="PARAMETERS" value="angular:route $Prompt$" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
<tool name="Create Controller" description="Generates a controller in app/scripts/controllers." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">