Skip to content

Instantly share code, notes, and snippets.

View andreasvirkus's full-sized avatar
🙊
made you look

andreas andreasvirkus

🙊
made you look
View GitHub Profile
/**
* A very basic (linear) scroll to top function
*/
function scrollToTop () {
if(window.scrollY!=0) {
setTimeout(function() {
window.scrollTo(0,window.scrollY-30);
TopscrollTo();
}, 20);
}
/**
* Credit goes to the very useful gomakethings.com
*
* https://gomakethings.com/ditching-jquery/
*
* Determine if an element is in the viewport
* @param {Node} elem The element
* @return {Boolean} Returns true if element is in the viewport
*/
var isInViewport = function ( elem ) {
// Another poor man's vanilla throttle script
window.addEventListener('scroll', throttle(callback, 1000));
// v1
function throttle(fn, wait) {
var time = Date.now();
return function() {
if (time + wait - Date.now() < 0) {
/**
* Load Enqueued Scripts in the Footer
*
* Automatically move JavaScript code to page footer, speeding up page loading time.
*/
function footer_enqueue_scripts()
{
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
/**
* Light breadcrumbs lookup using the native wp_nav_menu
*
* @param string $themeLocation
* @param string $separator
*
* @return string
*/
function getBreadcrumbs($themeLocation = 'primary', $separator = ' &rang; ') {
/**
* A simple user script to customise the layout
* of JIRA's Backlog (add some keyboard shortcuts + hide
* unnecessary stuff)
*
* // TODO:
* - Set shortcut for moving back to parent ticket + creating sub task
* (useful when the focus jumps to the newly created subtask)
* - Set shortcut for assigning story points
*/
// Condensed logical operators
var operators = new Function("return {"+ "==,===,!=,!==,<,>,<=,>=" .replace(/([^,]+)/g, "'$1': function (l, r) { return l $1 r; }\n")+ ",'typeof': function (l, r) { return typeof l == r; } }")();
// And beating 'round the bush
var operators = {
'==': function (l, r) { return l == r; },
'===': function (l, r) { return l === r; },
'!=': function (l, r) { return l != r; },
'!==': function (l, r) { return l !== r; },
'<': function (l, r) { return l < r; },
// vanilla
var el = document.getElementById("foo"), child = el.firstChild, nextChild;
while (child) {
nextChild = child.nextSibling;
if (child.nodeType == 3) {
el.removeChild(child);
}
child = nextChild;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)