Skip to content

Instantly share code, notes, and snippets.

@martinandersen3d
martinandersen3d / cloudSettings
Last active February 15, 2018 02:52
Visual Studio Code Sync Settings GIST
{"lastUpload":"2018-02-15T02:52:27.739Z","extensionVersion":"v2.8.7"}
@martinandersen3d
martinandersen3d / merge-object.js
Created November 25, 2017 03:31 — forked from wycliffepeart/merge-object.js
Javascript Object.assign Alternative . The mergeObject() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.
function mergeObject(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key];
}
}
}
return target;
@martinandersen3d
martinandersen3d / LICENSE
Created December 2, 2017 21:21 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@martinandersen3d
martinandersen3d / uuid.js
Created December 3, 2017 21:09 — forked from antonioaguilar/uuid.js
Generate UUID in Browser
function UUID() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
@martinandersen3d
martinandersen3d / vue draggable nested tree.vue
Last active December 8, 2017 00:36
vue draggable nested tree [Solution & Working, vue 2.x]
// PARENT -----------------------------------------------------
<template>
<div>
<devinfo :code='$data' name='treeParent' ></devinfo>
<b-field label="Add Page">
<input ref='pageTextField' @keyup.enter="addPageFromTextfield" v-model="textfieldvalue">
</b-field>
<treeChild :data="data"></treeChild>
@martinandersen3d
martinandersen3d / Has all.js
Created December 12, 2017 04:16
Compare two arrays, arrA must have all the items that is in arrB
/**
* Returns TRUE if the first specified array contains all elements
* from the second one. FALSE otherwise.
*
* @param {array} superset
* @param {array} subset
*
@martinandersen3d
martinandersen3d / laravel collection vs code snippet.json
Last active January 15, 2019 09:57
laravel collection vs code snippet
// in project folder: "\.vscode\snippets\vue.json"
// Put snippets at .vscode/snippets/<languageId>.json
// For example, .vscode/snippets/javascript.json
// extension: project snippet: https://github.com/rebornix/vscode-project-snippet
{
"all": {
"prefix": "all()",
"body": [
".all($1)"
],
@martinandersen3d
martinandersen3d / wordpress plugin post request form.php
Last active February 1, 2023 22:51
wordpress plugin post request form
//-----------------------Intro - most important:
// wp-content/themes/evolve/functions.php
function funkyMonky() {
// Handle request then generate response using echo or leaving PHP and using HTML
echo "hi";
}
add_action('admin_post_takeaway_settings_order','funkyMonky');
<?php
/**
* kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
* Copyright (C) 2002, 2003, 2005 Ulf Harnhammar
*
* This program is free software and open source software; you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
@martinandersen3d
martinandersen3d / 1) Main.blade.php
Created April 26, 2018 07:38 — forked from jacurtis/1) Main.blade.php
Laravel 5.4 Components & Slots
<!-- This is the main Blade file that you want your components to show up in -->
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>