Skip to content

Instantly share code, notes, and snippets.

Ismayil Khayredinov hypeJunction

Block or report user

Report or block hypeJunction

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Form.js
define(function (require) {
var $ = require('jquery');
var Deferrable = function (selector) {
var that = this;
/**
* @private
*/
this.$el = $(selector);
View async-form-handlers.html
<form id="my-form">
<input
type="text"
name="foo"
placeholder="Foo"
/>
<input
type="text"
name="bar"
View route-confirm-payment.js
app.post('/courses/confirmPayment', async (req, res, next) => {
const paymentIntentId = req.body.paymentIntentId;
const respondWithError = () => {
res.json({
'error': true,
'message': 'There was a problem with your payment, but we have made record of your enrolment. We will be in touch via email with further instructions.',
});
};
View route-enrol.js
const generatePaymentResponse = (intent) => {
// Note that if your API version is before 2019-02-11, 'requires_action'
// appears as 'requires_source_action'.
if (intent
&& (intent.status === 'requires_action' || intent.status === 'requires_source_action')
&& intent.next_action.type === 'use_stripe_sdk'
) {
// Tell the client to handle the action
return {
View EnrolForm.vue
<template>
<div>
<div v-if="isSuccess">
{{ isSuccess }}
</div>
<n-form v-else @submit="submitForm">
<n-stripe-card
v-model="model.stripeToken"
label="Secure Payment Info"
View VueCodemirror.vue
<template>
<textarea ref="codemirror"></textarea>
</template>
<script>
export default {
model: {
event: 'input',
prop: 'value',
},
View VueCodemirror.js
export default {
install (Vue) {
Vue.prototype.$codemirror = {
async load (options) {
await import('codemirror/lib/codemirror.css');
const module = await import('codemirror/lib/codemirror.js');
const CodeMirror = module.default;
const modes = options.modes || [];
View VueRecaptchaExample.vue
<template>
<vue-recaptcha
v-model="model.captcha"
/>
</template>
<script>
import Vue from 'vue';
import VueRecaptcha from './VueRecaptcha';
@hypeJunction
hypeJunction / VueRecaptcha.vue
Created Jul 4, 2019
Vue reCaptcha component
View VueRecaptcha.vue
<template>
<div
ref="recaptcha"
:data-sitekey="$recaptcha.siteKey"
:data-theme="theme"
:data-size="size"
></div>
</template>
<script>
View VueRecaptcha.js
export default {
install (Vue, { siteKey }) {
Vue.prototype.$recaptcha = {
siteKey,
load () {
return new Promise((resolve, reject) => {
if (typeof window.grecaptcha === 'undefined') {
const script = document.createElement('script');
script.src = 'https://www.google.com/recaptcha/api.js';
You can’t perform that action at this time.