Skip to content

Instantly share code, notes, and snippets.

View partapparam's full-sized avatar

Param Singh partapparam

View GitHub Profile
// Express Middleware built to convert all incoming request body data to snake_case
// Requires npm install lodash
const { snakeCase } = require("lodash")
const snakeCaseKeys = (data) => {
// check to see if req.body is an array.
if (Array.isArray(data)) {
// if Array, map() through all objects in Array.
return data.map((object) => snakeCaseKeys(object))
} else if (data !== null && data.constructor === Object) {
@partapparam
partapparam / gist:b7c1ae680c06649a36680d8b46b67204
Last active December 2, 2017 22:46 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Orchid Eats - Construction Mode</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@partapparam
partapparam / app.js
Created November 8, 2017 02:33 — forked from rnkoaa/app.js
A simple angularjs with angular-ui modal form which includes validation on the client side. Thanks http://scotch.io/tutorials/javascript/angularjs-form-validation
var app = angular.module("modalFormApp", ['ui.bootstrap']);
app.controller("modalAccountFormController", ['$scope', '$modal', '$log',
function ($scope, $modal, $log) {
$scope.showForm = function () {
$scope.message = "Show Form Button Clicked";
console.log($scope.message);
var modalInstance = $modal.open({