This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable no-console */ | |
| const express = require('express'); | |
| const bodyParser = require('body-parser'); | |
| const app = express(); | |
| /* | |
| Shopify issues a HTTP POST request. | |
| - https://help.shopify.com/api/tutorials/webhooks#receive-webhook |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ReactGA from 'react-ga'; // https://github.com/react-ga/react-ga | |
| import { React, Component } from 'react'; | |
| class MyApp extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| someData: null, | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const admin = require('firebase-admin'); | |
| admin.initializeApp({ | |
| credential: admin.credential.cert('./movies-387bf-firebase-adminsdk-4hoi8-c52699119b.json'), | |
| databaseURL: 'https://movies-387bf.firebaseio.com', | |
| }); | |
| // Get a database reference to our blog | |
| const db = admin.database(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // libraries | |
| const express = require('express'); | |
| const https = require('https'); | |
| const fs = require('fs'); | |
| const cors = require('cors'); // Cross-Origin Resource Sharing | |
| // setup express | |
| const app = express(); | |
| app.use(cors()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getURL(startMatch, endMatch, str) { | |
| var regex = new RegExp(startMatch + ': (.+), ' + endMatch); | |
| var contents = str.split(regex)[1]; | |
| return contents ? contents : 'none found'; | |
| } | |
| var str = 'website: http://www.google.com, soundcloud: http://www.soundcloud.com, facebook: http://www.facebook.com, stage: the main one'; | |
| console.log('Website URL:', getURL('website', 'soundcloud', str)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Currency Conversion</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" | |
| crossorigin="anonymous"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const https = require('https'); | |
| const fs = require('fs'); | |
| const cors = require('cors'); | |
| const rpn = require('request-promise-native'); | |
| const bodyParser = require('body-parser'); | |
| /* eslint-disable comma-dangle,arrow-parens,max-len,no-console */ | |
| const app = express(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| has_no_paypal_tag = Input.cart.line_items.any? { |line_item| line_item.variant.product.tags.include?('no-paypal') } | |
| if has_no_paypal_tag | |
| Output.payment_gateways = Input.payment_gateways.delete_if { |payment_gateway| payment_gateway.name.include?("PayPal") } | |
| else | |
| Output.payment_gateways = Input.payment_gateways | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const CDP = require('chrome-remote-interface'); | |
| const chromeLauncher = require('chrome-launcher'); | |
| const cheerio = require('cheerio'); | |
| (async function() { | |
| const launchChrome = () => | |
| chromeLauncher.launch({ chromeFlags: ['--disable-gpu', '--headless'] }); | |
| const chrome = await launchChrome(); | |
| const protocol = await CDP({ port: chrome.port }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // using jQuery | |
| $("#2020data").submit(function(e) { | |
| $.ajax({ | |
| url: "https://e0d92634.ngrok.io/test", | |
| type: "POST", | |
| data: new FormData(this), | |
| processData: false, | |
| contentType: false | |
| }); |