- Open Help -> Toggle Developer Tools in the menu (Ctrl + Shift + I)
- Paste JavaScript code below into the Console and execute.
var styleNode = document.createElement('style'); styleNode.type = "text/css"; var styleText = document.createTextNode(` @font-face { font-family: "Fira Code";
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 getRgbInverse(red, green, blue) { | |
const rgb = [parseInt(red), parseInt(green), parseInt(blue)] | |
let hsp = Math.sqrt( | |
0.299 * (rgb[0] * rgb[0]) + | |
0.587 * (rgb[1] * rgb[1]) + | |
0.114 * (rgb[2] * rgb[2]) | |
) |
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
let pointOne = { | |
x: 20, | |
y: 20, | |
} | |
let pointTwo = { | |
x: 40, | |
y: 40, | |
} |
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
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
-- ============================================= | |
-- Author: Adam DeHaven | |
-- Create date: 2019-10-25 | |
-- Description: Parses a key=value query string (delimited by a comma or ampersand) and return the key-value pairs as a table |
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
pagination(currentPage, pageCount) { | |
let delta = 1, | |
left = currentPage - delta, | |
right = currentPage + delta + 1, | |
result = [] | |
result = Array.from({ length: pageCount }, (v, k) => k + 1) | |
.filter(i => i && i >= left && i < right) | |
if (result.length > 1) { |
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
<a class="louarcade-show-modal" href="#">Open Modal</a> | |
<div class="louarcade-modal-overlay"> | |
<div class="louarcade-modal-container"> | |
<div class="louarcade-modal-content"> | |
<button class="louarcade-modal-x louarcade-hide-modal">×</button> | |
Insert modal content. | |
</div> |
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
CREATE FUNCTION [dbo].[SplitCommaDelimitedString] | |
( | |
@string NVARCHAR(MAX), | |
@delimiter CHAR(1) | |
) | |
RETURNS @output TABLE(splitdata NVARCHAR(MAX) | |
) | |
BEGIN | |
DECLARE @start INT, @end INT | |
SELECT @start = 1, @end = CHARINDEX(@delimiter, @string) |
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 triggerEvent(el, type) { | |
if ('createEvent' in document) { | |
// modern browsers, IE9+ | |
var e = document.createEvent('HTMLEvents'); | |
e.initEvent(type, false, true); | |
el.dispatchEvent(e); | |
} else { | |
// IE 8 | |
var e = document.createEventObject(); | |
e.eventType = type; |
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
$.fn.pasteEvents = function( delay ) { | |
if (delay == undefined) delay = 20; | |
return $(this).each(function() { | |
var $el = $(this); | |
$el.on('paste', function() { | |
$el.trigger('prepaste'); | |
setTimeout(function() { $el.trigger('postpaste'); }, delay); | |
}); | |
}); | |
}; |
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
<?php | |
// LOAD FROM FILE | |
$xml = simplexml_load_file('sample.xml'); | |
// ALTERNATE LOAD FROM STRING | |
// $xml = simplexml_load_string($xmlResponse); | |
foreach($xml->data as $data) { | |
$namespaces = $data->getNameSpaces(true); | |
$a = $data->children($namespaces['a']); |