Skip to content

Instantly share code, notes, and snippets.

View vahidhedayati's full-sized avatar

Vahid Hedayati vahidhedayati

View GitHub Profile
@vahidhedayati
vahidhedayati / ggts-exclamation-howto
Created January 20, 2015 20:03
Grails GGTS how to overcome red exclamation mark or and red cross
Right I think its about time I put down some notes on this for an easy way of fixing plugin/war files with files missing that you may download off of git or other public places.
1. Plugins.
1.1 : Plugin missing files
If you pull in a plugin and attempt to open it in ggts sometimes it shows an incorrect folder structure and so on, a manual fix to this is to remove the project from ggts. then
1.1.1 : automatic fix:
run : grails integrate-with --eclipse
@vahidhedayati
vahidhedayati / Grails3 plugin instructions.md
Last active July 31, 2016 14:52
Grails3 plugin instructions.md

http://grails.github.io/grails-doc/3.0.x/guide/upgrading.html

Follow above instructions in order to get the content of your grails plugin from older grails into grails 3.

A few notes on plugin names and folder names, I put down a few things here: https://groups.google.com/forum/#!topic/grails-dev-discuss/cG_6mvAO3f8

In there I mentioed mvn install - which does not appear to work under normal circumstances, in order to get a plugin to work locally follow grails install instructions or do it as inline plugin ..

@vahidhedayati
vahidhedayati / gist:71d92f8153ade5d732b3
Last active August 29, 2015 14:25
Apache-Shiro-LDAP-Dynamic-Permissions for grails

This is a guide on how to create dynamic security control for a grails application, in effect to control the actual security of your controller and actions for them via your own customised domainClasses and its own auto generated controllers views for the new domain classes. In this example the application refers to two additional domain objects: Environment and Application class. It also includes these as part of the authentication process. So if url being:

/doSomething/somethingAction?appId=XX&envId=XX

where controller is doSomething and action is somethingAction in that controller. It does a further check against those specifics on that somethingAction of appId and envId also matching security checks.

So if all you wish to do is basic dynamic controller and its action control then simply remove any reference do environment/application.

The below code would work in conjunction with a customised shiro configuration found:

@vahidhedayati
vahidhedayati / gist:1df1597662065931b2083adfbdda0a54
Created October 17, 2016 22:42
compileStatic - config this way
@CompileStatic
class QueuekitLists {
////
/**
* Retrieve configuration value of reportPriorties
* this should be a list containing key value e.g: ReportName:Priority.HIGH
*
* Assign report priority back if not set to DEFAULT LOW
*/
@vahidhedayati
vahidhedayati / TimeDuration removing milliseconds.md
Created October 21, 2016 10:01
TimeDuration removing milliseconds.md

When you have TimeCategory do calculation and return duration difference you will get it took 1.001 seconds for example.. To get rid of the milliseconds I used this hack, take from Tim Yates here:

http://stackoverflow.com/questions/16716802/how-to-format-time-durations-in-groovy

A slight tweak to set millseconds to 0 then parse out .000 from output...

  private String getDuration(Date startDate,Date endDate) {
 if (startDate && endDate) {
@vahidhedayati
vahidhedayati / gist:e5c839a534ce5fbd7b157bc617c44036
Last active May 29, 2017 14:03
Grails application logging errors to slack

Grails slack plugin appears to do most of the work here

Visit: https://slack.com/ and create a new slack channel Goto Configure apps/integration and create a webhook Configure webhook url in the plugin

If you are using pre grails 2.3, get hold of the grails 2 project from : https://github.com/mathifonseca/grails-slack/tree/grails-2.x

Copy the content of the plugin https://github.com/mathifonseca/grails-slack/tree/grails-2.x/src/groovy/grails/plugin/slack & https://github.com/mathifonseca/grails-slack/tree/master/grails-app/services/grails/plugin/slack to your local application For grails 2.0.1:

@vahidhedayati
vahidhedayati / incept-minikube.sh
Created November 1, 2018 09:37 — forked from osowski/incept-minikube.sh
Install Minikube, Kubectl, and Virtualbox on Ubuntu
#Installing VirtualBox
echo "Installing VirtualBox........................"
sudo apt-get install virtualbox
#Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/
echo "Installing kubectl..........................."
wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl

I have added 2 new fields remoteKey remoteValue to the VoerroTagsInput.vue which is referred to by other local vue These are the definitions of what comes back from the db - so a db could have city object stored and it could come back as cityId and cityName as the two fields we are searching for from a given dynamic data set -

In this gist I have included 2 other files:

  1. a wrapper class for VoerroTagsInput.vue which is referred to by other local vue
  2. The actual example vue calling and rewriting db data to match above sample and VoerroTagsInput.vue appears to locally work fine
@vahidhedayati
vahidhedayati / publish-vue-to-npm.md
Last active November 20, 2019 16:17
How to publish a vue js plugin to npm

This is a guide after trying to figure out how to publish to npm

After creating a directory

run npm init inside folder you will need a few base files

Answer questions and this will produce a package.json

Follow some of the base files in this folder and update definitions to match your plugin

@vahidhedayati
vahidhedayati / vuex.md
Last active November 27, 2019 16:39
vuex mutations/actions