Skip to content

Instantly share code, notes, and snippets.

The next #theforeman community demo is live now on Youtube - https://www.youtube.com/watch?v=BaEz47qF2xU - join us live and ask questions in our chat channel! #community
@sharvit
sharvit / katello_test_error.md
Last active September 16, 2018 15:40
Ketello test error
[vagrant@centos7-luna-devel foreman]$ bundle exec rake test:katello TEST=../katello/test/models/product_content_test.rb
WARNING: File locale/es/LC_MESSAGES/foreman_openscap.mo outdated, regenerate with 'make all-mo'
WARNING: File locale/sv_SE/LC_MESSAGES/foreman_openscap.mo outdated, regenerate with 'make all-mo'
/home/vagrant/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/home/vagrant/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls.
rake aborted!
ArgumentError: A class was passed to `:class_name` but we are expecting a string.
/home/vagrant/.rvm/gems/ruby-2.4.4/gems/activerecord-5.2.1/lib/active_record/reflection.rb:436:in `initialize'
@sharvit
sharvit / FactChartHelpers.js
Created July 8, 2018 06:51
redux selectors naming conventions
/*
FactChartHelpers.js
*/
export const createHostCounterFromFactChartData = (chartData = []) =>
chartData.length > 0
? chartData
.map(item => item[1])
.reduce((accumulator, currentValue) => accumulator + currentValue)
: 0;
TASK [foreman_installer : Run installer] ***************************************
Wednesday 30 May 2018 15:39:49 +0300 (0:00:00.018) 0:03:59.454 *********
fatal: [centos7-devel]: FAILED! => {
"changed": true,
"cmd": "foreman-installer -v --scenario \"katello-devel\" --disable-system-checks --katello-devel-enable-ostree=true",
"delta": "0:00:15.385362",
"end": "2018-05-30 12:40:04.722483",
"rc": 1,
"start": "2018-05-30 12:39:49.337121"
}
@sharvit
sharvit / BreadcrumbBar.md
Last active April 26, 2018 10:14
BreadcrumbBar toturial

BreadcrumbBar

breadcrumb-bar-2

Breadcrumbs display a users location within an application hierarchy. They act as a resource to help users navigate more efficiently and provide additional context.

The Breadcrumb Switcher provides a shortcut for users to quickly navigate to parallel pages, rather than navigating back to the previous page and making a new selection.

@sharvit
sharvit / ToastNotifications.md
Last active March 8, 2018 14:32
Foreman toast-notifications readme

Toast Notifications

Types

['error', 'warning', 'success', 'info']
// deprecated-types
['notice']

Create notification from the server

@sharvit
sharvit / README.md
Created February 21, 2018 08:07
Git commands

Cancel 1 last commit, and keep the changes:

git reset HEAD~1

Can replace the number 1 to cancel more than one commit at once:

git reset HEAD~5

Can cancel the commit and remove the changes (dangerous) :

@sharvit
sharvit / layout_helper.rb
Created January 18, 2018 15:08
Breadcrumbs layout helper
def get_resource
instance_variable_get("@#{controller_name.singularize}")
end
def get_resource_label(resource)
resource.try(:to_label) || resource.try(:to_s) unless resource.new_record?
end
def get_resource_menu(resource)
label = get_resource_label(resource)
@sharvit
sharvit / README.md
Last active January 15, 2018 09:04
Testing redux actions

Testing redux actions

Goals:

  1. Create a pure unit-testing

    • Do net allow the tests to get out from the file context
    • Mock all imports and treat them as simple inputs
    • Do not use store to test the actions
  2. Use snapshots

@sharvit
sharvit / axios-test-error.diff
Last active January 11, 2018 09:07
error while running test on foreman axios branch
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): Error: expect(received).toEqual(expected)
Expected value to equal:
[{"payload": {"id": "operatingsystem", "search": "/hosts?search=os_title=~VAL~", "title": "OS Distribution", "url": "statistics/operatingsystem"}, "type": "STATISTICS_DATA_REQUEST"}, {"payload": {"id": "architecture", "search": "/hosts?search=facts.architecture=~VAL~", "title": "Architecture Distribution", "url": "statistics/architecture"}, "type": "STATISTICS_DATA_REQUEST"}, {"payload": {"data": [["centOS 7.1", 6]], "id": "operatingsystem", "search": "/hosts?search=os_title=~VAL~", "title": "OS Distribution", "url": "statistics/operatingsystem"}, "type": "STATISTICS_DATA_SUCCESS"}, {"payload": {"data": [["x86_64", 6]], "id": "architecture", "search": "/hosts?search=facts.architecture=~VAL~", "title": "Architecture Distribution", "url": "statistics/architecture"}, "type": "STATISTICS_DATA_SUCCESS"}]
Received:
+ Array []
Difference:
- Expected