This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* creator: Danj (https://github.com/DanBrothers) | |
* description: custom notification, made for easy configuration (works with mobile) | |
* license: MIT, please link to this if you copy (thanks) | |
* | |
* usage: | |
var customnotes = new customnotes({ | |
enabled: true, | |
default: false | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openf12() { | |
var keyboardEvent = document.createEvent("KeyboardEvent"); | |
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent"; | |
keyboardEvent[initMethod]( | |
"keydown", // event type : keydown, keyup, keypress | |
true, // bubbles | |
true, // cancelable | |
window, // viewArg: should be window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Using_dynamic_styling_information --> | |
<html> | |
<head> | |
<title>Modifying a stylesheet rule with CSSOM</title> | |
<style type="text/css"> | |
.test { | |
background-color: red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* creator: Danj (https://github.com/DanBrothers) | |
* description: encode and decode img from base64 | |
* license: MIT, please link to this if you copy (thanks) | |
* | |
* usage: | |
var base64 = getBase64FromImage(document.getElementById("imageid")); | |
var img = getImageFromBase64(base64); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* creator: Danj (https://github.com/DanBrothers) | |
* description: logger, made for easly configuration | |
* license: MIT, please link to this if you copy (thanks) | |
* | |
* usage: | |
var console = new Logger({ | |
enabled: true, | |
enabledebug:true, | |
customfunction: function(e){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* creator: Danj (https://github.com/DanBrothers) | |
* description: sort a array by key values | |
* license: MIT, please link to this if you copy (thanks) | |
* | |
* usage: | |
//returns a sorted array | |
sortby(array, { | |
desc: true, | |
prop: "name", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make a random id with specified length, and get chars out of specified string | |
function makeid(length, string) { | |
var text = ""; | |
//the list of chars to pick chars for id | |
var possible = (string ? string : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); | |
//iterate over every char, with default length of 8 characters | |
while (text.length < (length ? length : 8)) { | |
//add a random picked char from "possible" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/*usage: | |
request("get", "https://github.com/DanBrothers/danbrothers.github.io/blob/master/js/main.js", null, | |
function(status, data) { | |
if(status==="percent") { | |
console.log("file progress: " + data + "%"); | |
} | |
if(...) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* creator: Danj (https://github.com/DanBrothers) | |
* description: check diffrence between two arrays | |
* license: MIT, please link to this if you copy (thanks) | |
* | |
* usage: | |
//returns array of diffrences | |
diff(arrayone, arraytwo); | |
//can also be used to check two files, by creating two arrays of the two files |
NewerOlder