Skip to content

Instantly share code, notes, and snippets.

@samueleiche
samueleiche / Debuggr.ts
Last active October 27, 2023 12:57
Log console on screen
class Debuggr {
private root: HTMLElement
private container: HTMLElement
private clearArea: HTMLElement
constructor() {
const root = document.createElement('div')
root.style.position = 'absolute'
root.style.top = '0px'
root.style.left = '0px'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samueleiche
samueleiche / .htaccess
Created March 31, 2020 21:27
Vue.js VueRouter .htaccess config for subdirectory
<IfModule mod_rewrite.c>
DirectoryIndex /vue/dist/index.html
RewriteEngine On
RewriteBase /vue/dist
RewriteRule ^vue/dist/index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /vue/dist/index.html [L]
</IfModule>
@samueleiche
samueleiche / cloudSettings
Last active November 25, 2020 11:36
Visual Studio Code settings sync
{"lastUpload":"2020-11-25T11:36:55.420Z","extensionVersion":"v3.4.3"}
@samueleiche
samueleiche / parse.js
Last active December 6, 2019 20:45
JS parse query string/serialize object - Supports arrays - Working example - https://codepen.io/Samuel87/pen/QWWZopj
/**
* Parses a serialized query string to an object
*
* @param {string} query - query string to parse
* @returns {Object}
* @example
* parse('a=b&c=d');
* // => { a: 'b', c: 'd' }
* @example
* parse('a[]=b&a[]=c');
@samueleiche
samueleiche / msie.css
Last active December 6, 2019 20:37
Detect if Internet Explorer in CSS and JS.
// if IE10+
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
// IE styles...
}
@samueleiche
samueleiche / Store.js
Created December 6, 2019 20:35
Simple state management for Vue.js using Vue observable.
/**
* Simple state management for Vue.js.
*
* @plugin
* @example
* new Store({
* form: {
* state: {
* searchText: '',
* },
@samueleiche
samueleiche / BreakpointObserver.js
Last active December 6, 2019 20:32
Breakpoint observer plugin for Vue.js using Vue observable.
/**
* A media query matcher plugin for Vue.js, to listen to
* matching breakpoints.
*
* @plugin
* @example
* const breakpoints = { mdDevice: '(max-width: 959px)' };
* Vue.use(BreakpointObserverPlugin, breakpoints);
* {
* computed: {
@samueleiche
samueleiche / Portal.js
Last active December 6, 2019 20:30
Portal plugin for Vue.js using Vue observable.
/**
* A Portal Plugin for Vue.js, to render components
* outside of other components, anywhere in the document.
*
* @plugin
* @example
* Vue.use(PortalPlugin);
* {
* computed: {
* portalTarget() {
@samueleiche
samueleiche / package.json
Last active December 7, 2019 15:30
Vue webpack config for Wordpress or any other custom project
{
"name": "vue-webpack-config",
"version": "0.0.0",
"private": true,
"eslintConfig": ".eslintrc.js",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack --watch",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules -p",
"clean:modules": "rm -rf ./node_modules"
},