Skip to content

Instantly share code, notes, and snippets.

@spiralx
spiralx / gulpfile-suspend-watcher.js
Last active December 15, 2016 23:37
Gulp - suspend watcher during task execution
var gulp = require('gulp');
function doGitCheckout(callback) {
console.log('doing checkout...');
setTimeout(function() {
console.log('done checkout...');
callback();
}, 1000);
}
@ignlg
ignlg / example.js
Last active October 21, 2018 15:05
Fixes "TypeError: JSON.stringify cannot serialize cyclic structures" error when exporting to JSON a KeystoneJS model/list including virtuals.
var modelCleanCyclic = require('./modelCleanCyclic');
var Example = new keystone.List('Example', {});
Example.schema.set('toJSON', {
virtuals: true,
transform: modelCleanCyclic.transformer
});
@ericrasch
ericrasch / TypeKit embed code.php
Last active July 4, 2017 03:54
Different methods for loading TypeKit's embed code.
<?php
/**
* TypeKit's default embed code.
* Source: http://help.typekit.com/customer/portal/articles/649336-embed-code
* Avg. Load Time: 191ms; 198ms; 265ms
*/
?>
<script type="text/javascript" src="//use.typekit.net/xxxxxxx.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@levymetal
levymetal / direct_parent.php
Last active November 27, 2023 04:17
Custom Wordpress function which uses a nav walker to display a list of child pages from a common parent, which can be called from either the parent page (displays children) or any of the child pages (displays siblings). Detailed instructions available on my blog post here: http://christianvarga.com/how-to-get-submenu-items-from-a-wordpress-menu-…
<?php
wp_nav_menu( array(
'menu' => 'Menu Name',
'sub_menu' => true,
'direct_parent' => true
) );