The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
// [0] the entire string, "require('my-module')" | |
// [1] require(' | |
// [2] my-module | |
// [3] ') | |
const captures = /(require\s*\(["'])(.*)(["']\s*\))/ig.exec(replacement); | |
const requireStart = captures[1]; | |
const requireEnd = captures[3]; | |
let moduleName = captures[2]; | |
// Use parentheses to denote capture groups, e.g. /(require)/ig will capture the word "require". |
(function () | |
{ | |
//Build a pseudo-class to prevent polluting our own scope. | |
var api = { | |
Settings: {}, | |
Vox: {}, | |
Start: function () | |
{ | |
//Get the *.myshopify.com domain | |
var shop = Shopify.shop; |
//Using ShopifySharp from https://github.com/nozzlegear/ShopifySharp | |
using ShopifySharp; | |
... | |
public void MySnippetCreatorMethod() | |
{ | |
var service = new ShopifyAssetService(myShopifyUrl, accessToken); | |
var themeId = 123456; | |
var asset = new ShopifyAsset() |
//Try to get the user's subscription charge. If it returns a 404 "Not Found" message, | |
//then their subscription is no longer valid. | |
try | |
{ | |
charge = await service.GetAsync(user.ShopifyChargeId.Value); | |
} | |
catch (ShopifyException e) | |
when (e.Message.Equals("not found", StringComparison.OrdinalIgnoreCase)) | |
{ | |
await DeleteChargeId(user); |
<Page | |
x:Name="pageRoot" | |
x:Class="Space_Butterfly.MainPage" | |
DataContext="{Binding Items, RelativeSource={RelativeSource Self}}" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:Space_Butterfly"\ | |
xmlns:common="using:Space_Butterfly.Common" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Windows.Storage; | |
using Windows.ApplicationModel.Background; | |
using ButterflyCore; | |
using Windows.UI.Notifications; | |
using Windows.Data.Xml.Dom; |
using ButterflyCore.Models; | |
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ButterflyCore.Models | |
{ | |
public class Thumbnail | |
{ |
/// <reference path="../typings/jquery/jquery.d.ts" /> | |
// Extend the jQueryAjaxSettings interface that should be defined at /scripts/typings/jquery/jquery.d.ts | |
// Don't have that file? Install with NuGet: install-package jquery.typescript.definitelytyped | |
interface JQueryAjaxSettings { | |
/** | |
* Load data from the server using a HTTP POST request. | |
* | |
* @param url A string containing the URL to which the request is sent. |