Skip to content

Instantly share code, notes, and snippets.

View sankargorthi's full-sized avatar

Sankar Gorthi sankargorthi

  • Veeva Systems
  • Pleasanton, CA
View GitHub Profile
@sankargorthi
sankargorthi / Application.js
Last active September 21, 2020 01:49
Debounced searchbox with persistent state
export const useSearchConfig = () => useContext(SearchContext);
export const useSetSearchConfig = () => useContext(SetSearchContext);
export function Application({ children, changingParam }) {
const [searchConfig, setSearchConfig] = usePersistentState(
`MyComponent${changingParam}`,
{ searchTerm: '', sortDirection: ASC },
)
return (
import { api } from '@cdm/cdms-data';
import { FeatureContext } from '@cdm/context';
import compact from 'lodash/compact';
import { useCallback, useContext, useReducer } from 'react';
import * as ACTION_TYPE from './actionTypes';
import reducer from './compareReducer';
import initialState from './initialState';
import Step2SecondVersion from './Step2SecondVersion';
export default function useComparisons(init, closeWizard, type) {
@sankargorthi
sankargorthi / builder.js
Last active August 29, 2015 14:17
component@1 builder
/* global __dirname */
var _ = require('lodash');
var log = require('debug')('builder:log');
var debug = require('debug')('builder:debug');
var error = require('debug')('builder:error');
/* File utilities */
var write = require('fs').writeFileSync;
var mkdir = require('mkdirp').sync;
@sankargorthi
sankargorthi / GruntFile.js
Last active January 3, 2016 17:49
Copy component.json to a work folder, parse and then nuke the work folder. I did this because `grunt.file.expand` was too slow on my project structure, especially with all the node_modules folders present under multiple sub-projects.
module.exports = function (grunt) {
'use strict';
require('load-grunt-tasks')(grunt);
grunt.renameTask('clean', 'nuke');
grunt.initConfig({
nuke: {
work: ['work']
},
@sankargorthi
sankargorthi / GruntFile.js
Last active December 23, 2015 13:59
Latest `grunt-component-build`
'use strict';
module.exports = function (grunt) {
var _, hbs, sass;
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
_ = require('underscore');
grunt.initConfig({
this.Given(/^I am doing something$/, function (callback) {
var browser = this.browser;
browser
.visit(this.home)
.then(function () {
browser.clickLink("Link Name")
.then(function () {
callback();
}).fail(function (e) {
callback.fail("Unable to click on Link Name", e);
@sankargorthi
sankargorthi / hooks.js
Created October 19, 2012 06:34
support/hooks.js
var hooks = function() {
var browser = require("browser.js");
this.Before(function(callback) {
console.log('hello');
callback();
});
this.After(function(callback) {
console.log('test complete');
Feature: Mailing Wizard
In order to send a Mailing
As an Administrator
I need to be able to create a Mailing
Scenario: Check the first tab has fields
Given I am on the Mailing Wizard
When I am on the first tab
Then I should see a "Mailing Name" input
And I should see a "Description" input