Skip to content

Instantly share code, notes, and snippets.

Avi Sharvit sharvit

Block or report user

Report or block sharvit

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
View ForemanModals.integration.test.js
import React from 'react';
import ForemanModal, { reducers } from './index';
import { setModalOpen, setModalClosed } from './ForemanModalActions';
import IntegrationTestHelper from '../../common/IntegrationTestHelper';
describe('ForemanModal - integration test', () => {
it('should flow', () => {
const integrationTestHelper = new IntegrationTestHelper(reducers);
View tests.log
FAIL webpack/assets/javascripts/react_app/redux/middlewares/IntervalMiddleware/__tests__/IntervalMiddleware.test.js
● Interval Middleware › should handle an action with "interval" key
expect(received).toMatchSnapshot()
Snapshot name: `Interval Middleware should handle an action with "interval" key 1`
Snapshot: [MockFunction] {
"calls": Array [
Array [
View autocomplete error
$("#kt_activation_keys").autocomplete(
activation_key_edit-1c6afff60f50622e92fb5fbeb14c1a46c9364c43041f84e134f6b1fcec5c3ed0.js:141 Uncaught TypeError: $(...).autocomplete is not a function
at HTMLDocument.<anonymous> (activation_key_edit-1c6afff60f50622e92fb5fbeb14c1a46c9364c43041f84e134f6b1fcec5c3ed0.js:141)
at HTMLDocument.dispatch (jquery.js:4737)
at HTMLDocument.elemData.handle (jquery.js:4549)
at Object.trigger (jquery.js:7807)
at HTMLDocument.<anonymous> (jquery.js:7875)
at Function.each (jquery.js:365)
at jQuery.fn.init.each (jquery.js:137)
at jQuery.fn.init.trigger (jquery.js:7874)
View board.js
var board = [
'X', ' ', 'X',
'O', 'O', 'X',
'O', 'O', 'X',
];
@sharvit
sharvit / slot-and-fill.js
Created Aug 18, 2019
Slot and fill suggestion
View slot-and-fill.js
const LayoutToolbarButtonsSlot = () => (<>
<Slot id="layout-toolbar-buttons" multi />
<Fill slot="layout-toolbar-buttons" weight={100}>
<ExportButton />
</Fill>
<Fill slot="layout-toolbar-buttons" weight={200}>
<DocumentationButton documentationURL={documentationURL} />
</Fill>
</>);
View addingDependenciesTutorial.md

Tutorial adding npm dependencies

Foreman manage npm dependencies with a seperate project called [@theforeman/vendor] which responsible to deliver 3rd-party modules to foreman and its plugins. Foreman and its plugins consumes [@theforeman/vendor] project from npm in development and from rpm in production.

[@theforeman/vendor] lives inside a monorepo together with other foreman javascript tools in a project called [foreman-js].

In this tutorial you will learn how to add a new dependency to be available for foreman and it's plugins.

@sharvit
sharvit / storybook.log
Created Jul 22, 2019
Katello storybook error
View storybook.log
[vagrant@centos7-luna-devel katello]$ npm run storybook
> katello@1.0.0 storybook /home/vagrant/katello
> start-storybook -p 6007
info @storybook/react v3.4.12
info
info => Loading custom .babelrc
info => Using default webpack setup based on "Create React App".
webpack built 1aa97886b35b66880a2b in 17370ms
View package.json
{
"name": "TheForemanDevDeps",
"version": "1.23.0",
"license": "GPL-3.0",
"description": "Foreman isn't really a node module, these are just dependencies needed to build the webpack bundle. 'dependencies' are the asset libraries in use and 'devDependencies' are used for the build process.",
"private": true,
"devDependencies": {
"@storybook/addon-actions": "~3.4.12",
"@storybook/addon-knobs": "~3.4.12",
"@storybook/react": "~3.4.12",
View 99-local.yaml
---
centos7-devel:
primary: true
box: centos7
sshfs:
host_path: '/home/asharvit/Projects/theforeman/vagrant-shares/centos7-devel'
guest_path: '/home/vagrant'
reverse: True
ansible:
playbook: 'playbooks/devel.yml'
View create-page-hoc.js
import React from 'react';
import { connect } from 'react-redux';
const AUDITS_API = 'AUDITS_API';
const createConstTypes = (constName) => {
return {
REQUEST: `${constName}_REQUEST`,
REQUEST: `${constName}_SUCCESS`,
REQUEST: `${constName}_FAILURE`,
You can’t perform that action at this time.