Skip to content

Instantly share code, notes, and snippets.

View davidroyer's full-sized avatar

David Royer davidroyer

View GitHub Profile
.darken-pseudo {
position: relative;
}
.darken-pseudo:after {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
<?php
function wp_modify_search_filter( $query ) {
if ( $query->is_search && $query->is_main_query() ) {
$query->set( 'post__not_in', array( 1,2,3,4,5,6 ) );
}
}
add_action( 'pre_get_posts', 'wp_modify_search_filter' );
@davidroyer
davidroyer / VueEditorStyles.vue
Created August 3, 2019 07:15
Example of how to customize Quill.js so it uses inline styles to format the editor content instead of its default way of using classes.
<template>
<VueEditor v-model="content" />
</template>
<script>
import { VueEditor } from "vue2-editor";
import Quill from "quill";
const AlignStyle = Quill.import("attributors/style/align");
Quill.register(AlignStyle, true);
@davidroyer
davidroyer / Display commit timestamp at github as javascript bookmark This simple js bookmark let you display the correct commit timestamp at github
javascript:(function() {
var relativeTimeElements = window.document.querySelectorAll("relative-time");
relativeTimeElements.forEach(function(timeElement){
timeElement.innerHTML = timeElement.innerHTML +" -- "+ timeElement.title;
})
}())
# Delete all local branches other than master
git branch | grep -v "master" | xargs git branch -D
createCustomProgramList() {
const customProgramList = this.programs.map(program => {
if (program.tagNames.includes("Adult Education")) {
program.degree_level = "Adult Education";
}
return program;
});
return customProgramList;
}
var formPlaceholder = document.createElement("div");
<div id="tlh-form-placeholder" class="mobile-placeholder"></div>
export const uniqueArray = originalArray => [...new Set(originalArray)]
export function slugify(textToSlugify) {
return textToSlugify
.toLowerCase()
.replace(/[^\w\s-]/g, '') // remove non-word [a-z0-9_], non-whitespace, non-hyphen characters
.replace(/[\s_-]+/g, '-') // swap any length of whitespace, underscore, hyphen characters with a single -
.replace(/^-+|-+$/g, '') // remove leading, trailing -
}
@davidroyer
davidroyer / product-select-reconfigure.css
Last active February 25, 2019 13:07
For Advancement Courses
.productAttributeConfigurablePickListSet div.selector.HIDE-ME {
display: none !important;
}
/*
Creates space for labels that need to be injected
*/
.productOptionViewSelect {
margin-top: 40px;