Skip to content

Instantly share code, notes, and snippets.

View bluepnume's full-sized avatar

Daniel Brain bluepnume

  • OneText
  • San Jose
View GitHub Profile
<script>
(function() {
var PAYPAL_SCRIPT = 'https://www.paypalobjects.com/api/checkout.js';
var ATTEMPTS = 3;
function loadPayPalCheckout(callback) {
ATTEMPTS -= 1;
var container = document.body || document.head;
[
"en_AD",
"fr_AD",
"es_AD",
"zh_AD",
"en_AE",
"fr_AE",
"es_AE",
"zh_AE",
"ar_AE",
<!-- Detect checkout.js eligibility -->
<script>
if (paypal.isEligible()) {
paypal.Button.render({ ... }, '#container');
}
</script>
<!-- Otherwise render static button with redirect -->
<!DOCTYPE html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script>
</head>
<body>
<!DOCTYPE html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script>
</head>
<body>
<div id="container">
'use strict';
const request = require('request-promise');
const ENV = 'sandbox';
const CLIENT_ID = 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R';
// 1. Write a `until(condition, finalCallback)` function that calls the `condition` function until the result is truthy, then calls the final callback
function waitUntilUserLoggedIn() {
until(function(callback) {
ajax('/api/user', function(err, user) {
if (err) {
callback(err);
} else {
callback(null, user.is_logged_in ? true : false)
}
function getPerson(name) {
let result = ajax('/api/person/' + name);
return result.person;
}
function getPersonDateOfBirth(name) {
let person = getPerson(name);
return person.dob;
}
// 1. Create a web form with a text box and a button. When the button is pressed, it should output a base64 encoded version of the text onto the page
// 2. Implement Array::map()
// 3. Implement Array::forEach()
// 4. Create a web form with a text field and a button. I should be able to enter a new word, press the button, and it should add my word to the page and keep all of the words that have been added in alphabetical order.
// 5. Create a 3x3 grid on the page and let me click on each grid element. This should toggle each square between black and white.
// Create a form with:
// * A text field for a credit card number
// * A button to submit the credit card
//
// Requirements:
//
// - The page should do some client side validation, and only allow credit card numbers which are:
// * 16 digits long