Skip to content

Instantly share code, notes, and snippets.

View joelcloralt's full-sized avatar

Joel Cloralt joelcloralt

View GitHub Profile
@joelcloralt
joelcloralt / oauth-callback.js
Last active February 7, 2024 19:34
Serverless function to handle oauth
const axios = require('axios');
const qs = require('qs');
exports.handler = async function(event, context) {
// Parse the 'code' from the query string
const { code } = event.queryStringParameters;
// Token endpoint for your service, this should be replaced with your actual token endpoint
const tokenURL = 'https://auth.smartcar.com/oauth/token';
@joelcloralt
joelcloralt / oauth-callback.js
Last active June 26, 2023 18:18
Netlify Function to exchange a code for an access token for Smartcar
const axios = require('axios');
const qs = require('qs');
exports.handler = async function(event, context) {
// Parse the 'code' from the query string
const { code } = event.queryStringParameters;
// Token endpoint for your service, this should be replaced with your actual token endpoint
const tokenURL = 'https://auth.smartcar.com/oauth/token';
@joelcloralt
joelcloralt / App.js
Last active August 29, 2015 14:23
ReactJS Flux
'use strict';
var React = require('react/addons');
var RouteHandler = require('react-router').RouteHandler;
var DocumentTitle = require('react-document-title');
var projectActions = require('./actions/projectActions');
var ProjectStore = require('./stores/projectStore');
var Header = require('./components/header');
var Footer = require('./components/footer');
var Bootstrap = require('./libraries/bootstrap/');
var BootstrapTheme = require('./libraries/bootstrap_theme.min/');
@joelcloralt
joelcloralt / functions.php
Created February 28, 2012 19:03
Create Wordpress Page on Theme Activation
// Create a page on theme activation
function privateMessagePage () {
$default_pages = array('This content is private'); //Page Title
$existing_pages = get_pages();
$temp = array();
foreach ($existing_pages as $page) {
@joelcloralt
joelcloralt / EmptyWidget.php
Created January 25, 2012 00:08 — forked from jonathonbyrdziak/CustomWidgetFile.php
Plugin code to create a single widget in wordpress.
<?php
/**
* @package RedRokk
* @version 1.0.0
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Empty_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com