In JavaScript RegExp.exec()
and String.match()
should be interchangeable so long as the inputs are the same. Right?
const pat = /(dog).*(bird)/g;
const str = 'dog cat bird';
const foo = str.match(pat);
const bar = pat.exec(str);
In JavaScript RegExp.exec()
and String.match()
should be interchangeable so long as the inputs are the same. Right?
const pat = /(dog).*(bird)/g;
const str = 'dog cat bird';
const foo = str.match(pat);
const bar = pat.exec(str);
{ | |
"55": {"w": 48.75, "h": 28.5}, | |
"60": {"w": 53.75, "h": 31}, | |
"65": {"w": 57, "h": 33} | |
} |
Add one line to a node.js module and it becomes a callable script:
// hello-module.js
module.exports = function() {
return "Hello!";
};
if (!module.parent) module.exports();
"use strict"; | |
const aws = require("aws-sdk"); | |
const s3 = new aws.S3({ apiVersion: "2006-03-01" }); | |
const dynamodb = new aws.DynamoDB(); | |
const isNum = n => !isNaN(parseFloat(n)) && isFinite(n); | |
exports.handler = (event, context, callback) => { | |
const jsonFileName = "14th-street-webcam.json"; |
*.3gp | |
*.3gpp | |
*.asf | |
*.asx | |
*.avi | |
*.bak | |
*.bin | |
*.deb | |
*.dll | |
*.dmg |
<?php | |
// Hide author's name from SEO Framework block | |
add_filter('sybre_waaijer_<3', '__return_false'); | |
// Move SEO Framework metabox below all custom fields | |
add_filter('the_seo_framework_metabox_priority', function () { | |
return 'low'; | |
}); |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Version: 0.5.0-0 | |
# Try reading package.name from ./site/package.json | |
begin | |
$hostname = JSON.parse(File.read(__dir__ + '/site/package.json'))['name'] | |
$themename = $hostname | |
rescue StandardError | |
end |
# Recommended with the Basic WordPress Vagrant project: https://github.com/ideasonpurpose/basic-wordpress-vagrant | |
# https://gist.github.com/41912f5d027a4adc7c14 | |
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp *.vagrant.d/tmp/hosts.local /etc/hosts | |
%admin ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE |
# https://gist.github.com/joemaller/4503986 | |
# | |
# A set of color functions to help with fancy $PS1 prompts | |
# | |
# This: | |
# PROMPT_COMMAND='PS1="\e[32;1m\]\u@\[\e[35;1m\]\H \[\e[0m\]\w]\$ "'' | |
# | |
# Can be more clearly written as: | |
# PROMPT_COMMAND='PS1="$(DARK_GREEN \\u@)$(PURPLE \\H) \w]\$ "'' | |
# |
# https://gist.github.com/joemaller/3165ace4b1f8a50924990ad373236ce8 | |
# | |
# Append this file to the end of your ~/.bashrc file | |
# Your terminal prompt will look something like this: | |
# | |
# username@hostname /output/of/pwd [git-branch]$ | |
# https://gist.github.com/4503986 | |
# |