Skip to content

Instantly share code, notes, and snippets.

View bmsterling's full-sized avatar

Benjamin Sterling bmsterling

View GitHub Profile
@bmsterling
bmsterling / machine.js
Last active March 2, 2021 19:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bmsterling
bmsterling / machine.js
Last active December 22, 2020 17:36
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bmsterling
bmsterling / machine.js
Last active January 13, 2021 18:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
/(\s|^)(?:@{1})([\w-À-ÖØ-öø-ÿĀ-ňŊ-ſА-я぀-ゟ゠-ヿ㄰-㆏가-힣一-黿]*)/g
const regexEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
export const validateEmail = (email) => {
let error = '';
if (!email) {
error = 'Required';
} else if (!regexEmail.test(email)) {
error = 'Invalid email address';
}
/* global module, __dirname */
const Webpack = require('webpack');
const merge = require('webpack-merge');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const BundleTracker = require('webpack-bundle-tracker');
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 984.01 617.55">
<defs>
<style>
.cls-1 {
isolation: isolate;
}
.cls-2 {
fill: #154463;
}
define([
'lodash'
], function () {
'use strict';
var pluginName = 'backgroundImage',
version = '',
throttle = _.throttle,
defaults = {},
BackgroundImage;
<?php
// define static var
define('DRUPAL_ROOT', getcwd());
// include bootstrap
include_once('./includes/bootstrap.inc');
// initialize stuff
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// clear cache
drupal_flush_all_caches();
?>
@bmsterling
bmsterling / gist:5600435
Created May 17, 2013 16:55
Selecting record less than a certain `_id`
Photo.find(
'_id' : {'$lte' : firstid},
'url thumbnailUrl',
{
skip : 0,
limit : 9,
sort : { 'created': -1 }
},
function (err, photos) {
}