Skip to content

Instantly share code, notes, and snippets.

View gabrielwolf's full-sized avatar
🎯
Focusing

Gabriel Wolf gabrielwolf

🎯
Focusing
View GitHub Profile
@gabrielwolf
gabrielwolf / machine.js
Last active September 3, 2020 05:23
Generated by XState Viz: https://xstate.js.org/viz
const baseURL = 'http://127.0.0.1:5000/'
const fetchTrackMeta = () => fetch(baseURL).
then((response) => response.json())
const MAX_RETRIES = 3
const limitRetries = (context) => {
return context.metaRetries <= MAX_RETRIES
}
@gabrielwolf
gabrielwolf / machine.js
Last active August 29, 2020 23:00
Generated by XState Viz: https://xstate.js.org/viz
const fetchTrackMeta = (trackId) =>
fetch(`url/to/track/${trackId}`).then((response) => response.json());
const ambisonicsMachine = Machine({
id: 'ambisonicsPlayer',
initial: 'idle',
context: {
trackMeta: null,
track: null,
metaRetries: 0,
@gabrielwolf
gabrielwolf / machine.js
Last active July 22, 2020 16:08
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gabrielwolf
gabrielwolf / setup-repo.sh
Last active July 22, 2019 13:38
Clone a repository to /var/www/html with secure permissions and ownership
#!/bin/bash
# setup-repo.sh | Script that clones a repository and sets up some directories.
# It also sets ownership of WORKROOT and subdirectories to $USER:www-data,
# creates a handy symlink to WORKROOT and sets GIT_DIR and GIT_WORK_TREE
REPOSITORY="https://github.com/gabrielwolf/zuk.git"
BRANCH="master"
WORKROOT="/var/www/html"
PROJECT_DIR="zuk-tagen-und-wohnen.de"
PROJECT_GIT_WORK_TREE="${WORKROOT}/${PROJECT_DIR}"
@gabrielwolf
gabrielwolf / group_vars-development-wordpress_sites.yml
Created January 25, 2018 08:49
trellis-database-uploads-migration config problem
wordpress_sites:
dock2dekoration.de:
site_hosts:
- canonical: dock2dekoration.local
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
admin_email: develop@wirbelprint.de
multisite:
enabled: false
ssl:
enabled: false
@gabrielwolf
gabrielwolf / _main.js
Created September 8, 2017 15:32
Sticky Footer (in jQuery)
// Sticky footer
// Window load event used just in case window height is dependant upon images
$(window).bind("load", function() {
var footerHeight = 0,
footerTop = 0,
$footer = $(".content-info");
function positionFooter() {
@gabrielwolf
gabrielwolf / .jsbeautifyrc
Last active August 25, 2018 13:11
Sublime Text 3 - Personal settings and plugins
{
"all":
{
"end_with_newline": true
},
}
@gabrielwolf
gabrielwolf / content-single-shooting.php
Last active September 7, 2017 16:55
Custom Posts in Sage
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
<div class="page-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</div>
<div class="content-container">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(array('before' => '<nav class="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>')); ?>
@gabrielwolf
gabrielwolf / gist:97dff9fddcf7485a0b88
Created January 21, 2015 10:57
Let FacetWP just index WooCommerce products
function my_facetwp_indexer_query_args( $args ) {
$args['post_type'] = 'product';
return $args;
}
add_filter( 'facetwp_indexer_query_args', 'my_facetwp_indexer_query_args' );