Turn Off
:noh
Turn Off / On
set nohlsearch
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 | |
class Model extends Database | |
{ | |
protected function validate_empty($data, $field, $err_message = null) | |
{ | |
if (empty($data[$field])) { | |
// Use first part of field name in string e.g. currency_id required => currency required | |
if (empty($err_message)) { | |
$err_message = explode("_", $field)[0] . ' required'; | |
} |
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
const audio = new Audio( 'https://dl.dropboxusercontent.com/s/h8pvqqol3ovyle8/tom.mp3' ); | |
audio.muted = true; | |
const alert_elem = document.querySelector( '.alert' ); | |
audio.play().then( () => { | |
// already allowed | |
alert_elem.remove(); | |
resetAudio(); | |
} ) |
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
.alert { | |
font: 14px Arial, sans-serif; | |
position: fixed; | |
top: 0; | |
left: 0; | |
background: white; | |
border: 1px solid lightgray; | |
box-shadow: 3px 3px 12px lightgray; | |
} | |
p { margin: 12px; } |
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
<div class="alert"> | |
<p>This webpage would like to play sounds</p> | |
<p class="buttons"> | |
<button value="0">Block</button> | |
<button value="1">Allow</button> | |
</p> | |
</div> | |
<button id="btn">trigger notification</button> |
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 myDelayedThing() { | |
var mySelectors = document.querySelectorAll('.something'); | |
// Loop through mySelectors | |
for(var i = 0; i < menuLinks.length; i++) { | |
// Add 'open' class on mouseover | |
menuLinks[i].addEventListener('mouseover', function() { | |
this.classList.add('open'); |
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
#Whenever an item is selected, move it to the back of the array and randomly select from a slice of the original array array.slice(0, -5). | |
var a = ["Roger", "Russell", "Clyde", "Egbert", "Clare", "Bobbie", "Simon", "Elizabeth", "Ted", "Caroline"]; | |
var chooseName = function () { | |
var unique = true; | |
num = Math.floor(Math.random() * a.length - 5); | |
name = a.splice(num,1); | |
a.push(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
* Exception: Error: Route did not complete loading: / at _callee$ (webpack-internal:///./node_modules/next/dist/client/route-loader.js:272:113) | |
at tryCatch (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:63:40) at Generator.invoke [as _invoke] | |
(webpack-internal:///./node_modules/regenerator-runtime/runtime.js:293:22) at Generator.eval [as next] | |
(webpack-internal:///./node_modules/regenerator-runtime/runtime.js:118:21) at asyncGeneratorStep | |
(webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next | |
(webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) | |
* message: "Route did not complete loading: /" stack: "Error: Route did not complete loading: /↵ | |
at _callee$ (webpack-internal:///./node_modules/next/dist/client/route-loader.js:272:113)↵ | |
at tryCatch (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:63:40)↵ | |
at Generator.invoke [as _invoke] (webpack-internal:///./node_modules/regen |
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
**ONE MORE SPINNER** | |
DEFAULT_SpinnerFrames=("—" "\\" "|" "/") | |
##@function: spinner(action, label, &spinnerFramesRef[]) | |
## | |
##@description: Perform an action asynchronously and display | |
##spinner till action is completed | |
## | |
##@param action: The action the execute |
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
**ANOTHER SPINNER** | |
#!/bin/sh | |
#The command you are waiting on goes between the ( ) here | |
#The example below returns a non zero return code | |
(sleep 20 ; /bin/false) & | |
pid=$! ; i=0 |
NewerOlder