Skip to content

Instantly share code, notes, and snippets.

@chalettu
chalettu / gist:3b8262c5e3e3c0f1394fbde95c64c165
Created June 21, 2018 16:37
Fix for opening up webpack port on forklift
Just add this below line 243
https://github.com/theforeman/forklift/blob/master/vagrant/lib/forklift/box_distributor.rb#L243
override.vm.network :forwarded_port, guest: 3808, host: 3808
@chalettu
chalettu / gist:c29752f7a7af1375a94d6b19e5f556b7
Created May 7, 2018 17:32
Custom button, service dialog drop down values are missing
{
"href": "https://10.8.198.232/api/service_dialogs/2",
"id": "2",
"description": "desc",
"buttons": "submit,cancel",
"created_at": "2018-05-03T20:27:27Z",
"updated_at": "2018-05-03T20:27:27Z",
"label": "multi",
"content": [
{
const started = __('was started.')
EventNotifications.success(`${item.name} ${started} ${response.message}`)
const mongoose = require('mongoose')
const rp = require('request-promise-native')
if (process.env.NODE_ENV !== 'production') require('dotenv').config()
mongoose.connect(process.env.DB_URL, { useMongoClient: true })
// mongoose.Promise = global.Promise
mongoose.set('debug', true)
var Server = require('./models/server')
@chalettu
chalettu / gist:a253e89267bf25136766268d30678fa9
Created September 19, 2017 20:36
Creating Generic Object Definitions and Generic objects 400 Error
//Create Object Definition
POST - localhost:3000/api/generic_object_definitions
{
"name" : "LoadBalancer",
"description" : "LoadBalancer description",
"properties" : {
"attributes" : {
"address" : "string",
"last_restart" : "datetime"
},
@chalettu
chalettu / gist:ea14bbd67b3fe080b891762ac3478be3
Created September 12, 2017 13:22
Travis CI detect Commit messages
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip validator\]'; export TWBS_DO_VALIDATOR=$?; true
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip sauce\]'; export TWBS_DO_SAUCE=$?; true
install:
- time npm install -g grunt-cli
- ./test-infra/s3_cache.py download npm-modules
- if [ "$TWBS_TEST" = validate-html ] && [ $TWBS_DO_VALIDATOR -ne 0 ]; then ./test-infra/s3_cache.py download rubygems; fi
@chalettu
chalettu / gist:b59b4dee08c80939b2d6f0e79e49c462
Created July 14, 2017 14:57
Conditionally loading cordova
// put this in your main.js
// add cordova.js only if serving the app through file://
if (window.location.protocol === 'file:' || window.location.port === '3000') {
var cordovaScript = document.createElement('script')
cordovaScript.setAttribute('type', 'text/javascript')
cordovaScript.setAttribute('src', 'cordova.js')
document.body.appendChild(cordovaScript)
}
@chalettu
chalettu / gist:06c981e32c0d8ad2a0ee9ff23701d27f
Created December 14, 2016 16:15
Unit test for component
describe('detail-reveal component', function() {
beforeEach(function(){
module('app.components', 'gettext');
});
describe('controller', function() {
var controller;
var $componentController;
var bindings = {title: 'Test', detail: 'test detail', icon: 'testIconClass', translateTitle: false, rowClass: 'test'};
@chalettu
chalettu / gist:7b233ab136d1366fc1c54b7b17b395ce
Created October 7, 2016 22:37
Simple Example on how to specify version of node in a script
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
nvm install 0.12.16
nvm use 0.12.16
Users.findOne({"id":user_id}).exec(function(err, user) {
stripe.customers.create({ //this saves the user to the platform account
source: tokenID,
email: user.email,
description: "Example customer"
}, function (err, customer) {
user.stripe_cust=customer.id;
//this attempts to create a token associated to the connected account id
stripe.tokens.create(