Skip to content

Instantly share code, notes, and snippets.

View Migweld's full-sized avatar

Craig Thompson Migweld

View GitHub Profile
@Migweld
Migweld / nextjs-inner-page-npm.js
Last active January 10, 2023 20:41
Inner page snippet & test file for a particular use-case from a NextJS app I created approximately 3 years ago. ES6 without Typescript. Demo can be found at https://babyfoodnpm.org
/* eslint-disable no-undef */
import React, { useReducer, useState, useEffect } from "react"
import PropTypes from "prop-types"
import Router from "next/router"
import { rules, marketingQuestions } from "../data/rules"
import { validateForm } from "../components/QuestionForm/validate"
import RulesForm from "../components/RulesForm/RulesForm"
import SectionTitle from "../components/SectionTitle/SectionTitle"
import {
ADVANCE_FORM,
Verifying that +migweld is my blockchain ID. https://onename.com/migweld
@Migweld
Migweld / README.md
Last active December 3, 2015 12:39
PSR-2 Build System using Sublime Text

PSR-2 Build System using Sublime Text

Installation

Open a new terminal and install Composer:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Once that has finished installing and moved, install the PHP-CS-Fixer Composer package globally:

@Migweld
Migweld / error.html
Created October 19, 2015 14:12
Laravel error
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"><script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function r(t){if(!n[t]){var o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var o=e[t][1][n];return r(o?o:n)},o,o.exports)}return n[t].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<t.length;o++)r(t[o]);return r}({QJf3ax:[function(e,n){function t(e){function n(n,t,a){e&&e(n,t,a),a||(a={});for(var u=c(n),f=u.length,s=i(a,o,r),p=0;f>p;p++)u[p].apply(s,t);return s}function a(e,n){f[e]=c(e).concat(n)}function c(e){return f[e]||[]}function u(){return t(n)}var f={};return{on:a,emit:n,create:u,listeners:c,_events:f}}function r(){return{}}var o="nr@context",i=e("gos");n.exports=t()},{gos:"7eSDFh"}],ee:[function(e,n){n.exports=e("QJf3ax")},{}],3:[function(e,n){function t(e){return function(){r(e,[(new Date).getTime()].concat(i(arguments)))}}var r=e("handle"),o=e(1),i=e(2);"undefined"==typeof window.newrelic&&(newrelic=window.NREUM);var a=["s
public function getTaxRate()
{
if(Input::has('country')){
//Get our inputs to send to Quaderno
$country = Input::get('country');
$vat = Input::get('vat');
$data = array('vat_number' => $vat, 'country' => $country);
QuadernoBase::init(Config::get('quaderno.sandbox_secret_key'), Config::get('quaderno.sandbox_url'));
@Migweld
Migweld / payment.blade.php
Created April 28, 2015 14:14
Payment form code
{{ Form::open(array('id' => 'payment-form', 'data-key' => 'pk_test_seSbNPyxuwnZN11QybR2', 'data-plan' => 'standardyearly', 'url'=>'payments', 'class'=>'form-payment-yearly', 'data-taxes' => 'included')) }}
{{ Form::hidden('quantity', 0, array('data-quaderno' => 'quantity')) }}
<span class="payment-errors"></span>
{{--User details--}}
{{ Form::text('first-name', $user->first_name, array('data-quaderno' => 'first-name', 'placeholder' => 'First name')) }}
{{ Form::text('last-name', $user->last_name, array('data-quaderno' => 'last-name', 'placeholder' => 'Last name')) }}
{{ Form::text('email', $user->email, array('data-quaderno' => 'email', 'placeholder' => 'Email')) }}
{{ Form::text('street-line-1', null, array('data-quaderno' => 'street-line-1', 'placeholder' => 'Address 1')) }}
{{ Form::text('street-line-2', null, array('data-quaderno' => 'street-line-2', 'placeholder' =>
@Migweld
Migweld / payment.js
Created April 28, 2015 14:08
Quaderno.js create sub
jQuery(function($) {
$('.form-payment-yearly').submit(function(event) {
event.preventDefault();
var $form = $(this);
// Disable the submit button to prevent repeated clicks
$form.find('.btn').prop('disabled', true);
// Get the card token from Stripe
Stripe.setPublishableKey($form.data('gateway-key'));
@Migweld
Migweld / gist:512fda1689f0639d44ff
Last active August 29, 2015 14:05
Loop over directories, regex and remove those with numbers
#!/bin/bash
$PARENTDIR = 'parent_dir here'
#Get a list of dirs/files in parent directory, pipe to egrep and select only directories then pipe to awk to get the 9th field (directory name). Check your shell to make sure $9 is actually the directory name
DIRS=`ls -l $MYDIR | egrep '^d'`| | awk '{print $9}'
# Loop through our directories
GIT
remote: git://github.com/jbrien/spree_sunspot_search.git
revision: f91273099b963efc64f3fa9b8ff6c4ff27f6c1ab
specs:
spree_sunspot (1.3)
spree_core (>= 1.1.0)
sunspot_rails (>= 2.0.0)
GIT
remote: git://github.com/spree/spree.git