Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
<?php | |
/* Iterator for arrays of WordPress posts or `WP_Query`. | |
* | |
* Simplifies "the loop" by automatically handling the `$post` global for each iteration | |
* (calling `the_post()`, `setup_postdata()` etc.) and makes sure to reset the global state when the loop has finished. | |
* | |
* Usage: | |
* Loop over ten last posts: | |
* <?php foreach (new WPQueryIterator(array('post_type' => 'post', 'posts_per_page' => 10)) as $i => $p): ?> | |
* <?php the_title(); ?> |
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// Greeter is a class of object that can greet people. | |
// It can learn different ways of greeting people through | |
// 'Strategies.' | |
// | |
// This is the Greeter constructor. | |
var Greeter = function(strategy) { | |
this.strategy = strategy; | |
}; | |
// Greeter provides a greet function that is going to |
// from Andrew Whitaker and Jazzbo, http://stackoverflow.com/a/15554920/161625 | |
$.fn.changeElementType = function(newType) { | |
var newElements = []; | |
$(this).each(function() { | |
var attrs = {}; | |
$.each(this.attributes, function(idx, attr) { | |
attrs[attr.nodeName] = attr.nodeValue; | |
}); |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
/* -------------------------------------------------------------------------- */ | |
// All Bootstrap 4 Sass Mixins [Cheat sheet] | |
// Updated to Bootstrap v4.5.x | |
// @author https://anschaef.de | |
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins | |
/* -------------------------------------------------------------------------- */ | |
/* | |
// ########################################################################## */ | |
// New cheat sheet for Bootstrap 5: |
From http://www.agcs.com/patterns/papers/respat.htm | |
Resign Patterns | |
Ailments of Unsuitable Project-Disoriented Software | |
by | |
Michael Duell | |
[email protected] | |
Abstract |
Install the custom CSS plugin, then make a file on your computer that will hold your custom CSS, I like to make one in my home directory called ~/.vscodestyles.css
and then add the CSS into it.
Once done, open your command palette and select enable custom CSS and JS