Skip to content

Instantly share code, notes, and snippets.

Stuart Nelson stuartjnelson

View GitHub Profile
View node-check-for-img.js
// Currenet setup
.use('/images/', express.static( path.resolve(`${imagePath}/images/`)) )
// New idea
.get('/' + 'images' + '/*', function (req, res) {
const imgUrl = `${imagePath}${req.url}`
console.log(`imgUrl: ${imgUrl}`)
const urlExists = url => new Promise(
(resolve, reject) => request.head(url) .on("response", res => resolve(res.statusCode.toString()[0] ==="2"))
@stuartjnelson
stuartjnelson / cloudSettings
Last active Jun 26, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-06-26T11:39:00.251Z","extensionVersion":"v3.3.0"}
@stuartjnelson
stuartjnelson / get_the_content.php
Created May 31, 2016
Getting `the_content()` from another post.
View get_the_content.php
<?php
$my_postid = 12;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
?>
@stuartjnelson
stuartjnelson / Ternary Statement PHP.php
Created Feb 10, 2016
Sublime Text Snippet PHP Ternary Statement
View Ternary Statement PHP.php
<snippet>
<content>
<![CDATA[
\$var = ( !empty( \$my_var ) ) ? \$my_var : 'default value';
]]></content>
<tabTrigger>ternary</tabTrigger>
<scope>source.php</scope>
<description>ternary …</description>
</snippet>
You can’t perform that action at this time.