Skip to content

Instantly share code, notes, and snippets.

Aaron Ranard aaronranard

Block or report user

Report or block aaronranard

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
aaronranard / key-value-transform.js
Last active Feb 15, 2018
Key Value object to Key Value Pair Array
View key-value-transform.js
const keyValueObj = { "api_url": "", "message": "BALLISTIC MISSILE INBOUND.", "is_drill": true };
const keyValueArray = Object.entries(keyValueObj).map(([key, value]) => ({ key, value }));
* keyValueArray:
* [
* { key: "api_url", value: "" },
* { key: "message", value: "BALLISTIC MISSILE INBOUND." },
* { key: "is_drill", value: true },
* ],


A few sentences describing the overall goals of the pull request's commits.


  • Tested and working locally
  • New API endpoints documented
  • Unit tests (if appropriate)
  • Integration tests (if appropriate)


aaronranard /
Last active Sep 1, 2017
abstract syntax tree


BNF grammar is in: examples/lang.bnf Lex grammar is in: examples/lang.lex

To see what is all possible view examples/test.lang


View RegisterCompany.js
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import debounce from 'throttle-debounce/debounce'
import axios from 'axios';
import SubmitButton from './SubmitButton'
export default class RegisterCompany extends Component {
constructor(props) {
aaronranard / ValidateAuthyMiddleware.php
Created Mar 31, 2017
Laravel Middleware for Authy OneTouch callback
View ValidateAuthyMiddleware.php
namespace App\Http\Middleware;
use Closure;
class ValidateAuthyRequest {
* Handle an incoming request.
aaronranard / currency-validator.js
Last active Oct 27, 2016 — forked from chrisvfritz/currency-validator.js
Currency Validator to account for commas in input
View currency-validator.js
var currencyValidator = {
format: function (number) {
return (Math.trunc(number * 100) / 100).toFixed(2)
parse: function (newString, oldNumber) {
var CleanParse = function (value) {
return { value: value }
var StringParse = function (string) {
return parseFloat(string.replace(/,/g, ''))
View phpecc.php
$loader = new PemLoader();
$math = EccFactory::getAdapter();
$this->messages = new MessageFactory($math);
$privKeySerializer = new PemPrivateKeySerializer(new DerPrivateKeySerializer());
$pubKeySerializer = new PemPublicKeySerializer(new DerPublicKeySerializer());
$PrivateKeyPath = env('KEY_LOCATION').'my.priv';
$PublicKeyPath = storage_path().'/app/'.uniqid().'.pub';
aaronranard / get-earliest-relative.php
Last active Nov 19, 2015
PHP: WordPress return top most parent ID
View get-earliest-relative.php
* [Gets the top most parent of a post. If post is top most parent, returns ID]
* @return int [ID of top most parent]
function get_earliest_relative($post){
if ($post->post_parent){
$parent = $ancestors[$root];
aaronranard / acf-select.php
Created Nov 10, 2015
PHP: WordPress ACF output select field
View acf-select.php
* Displaying a single value's Label
$field = get_field_object('field_name');
$value = get_field('field_name');
$label = $field['choices'][ $value ];
aaronranard / remove-acf-repeater-row.php
Last active Oct 23, 2015
acf's delete_sub_field call only makes the value null it doesn't actually delete the row. This does.
View remove-acf-repeater-row.php
* deleteSubField
* This function will delete a value of a sub field entirely and replace the rows correctly.
* ACF's built in delete_sub_field only sets the value to null
* @param $field_key (string) the field key of the top level custom field
* @param $repeater_key (string) the field key of the repeater element
* @param $post_id (int) the post_id of which the repeater is stored in
You can’t perform that action at this time.