Skip to content

Instantly share code, notes, and snippets.

@prashantpalikhe
prashantpalikhe / traceProperty.js
Created July 25, 2018 08:48
Devtools snippet to trace property access
const traceProperty = (object, property) => {
let value = object[property];
Object.defineProperty(object, property, {
get () {
console.trace(`${property} requested`);
return value;
},
set (newValue) {
console.trace(`setting ${property} to `, newValue);
value = newValue;
@ggarcia24
ggarcia24 / pipeline.gdsl
Last active June 15, 2024 20:25
GDSL supporting pipeline declarative
//The global script scope
def ctx = context(scope: scriptScope())
//What things can be on the script scope
contributor(ctx) {
method(name: 'pipeline', type: 'Object', params: [body: Closure])
property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable')
property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
property(name: 'currentBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder')
property(name: 'scm', type: 'org.jenkinsci.plugins.workflow.multibranch.SCMVar')
@62mkv
62mkv / Search-and-Replace-Structurally.md
Last active February 21, 2022 16:27
IntelliJ IDEA Receipts

Examples of Structural Search and Replace (IntelliJ IDEA 2017)

Use case 1 (Search)

Find all *DTO classes, that have a (at least one) public field that is neither @ApiModelProperty, nor a @JsonIgnore

  1. Open Edit->Find->Search structurally

  2. Paste this into Search template field:

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea
@gregsh
gregsh / - IDE Scripting.md
Last active June 21, 2024 06:16
IDE Scripting

Here are my attempts to script an IntelliJ-based IDE using javax.script.* API (ex-JSR-223).

The list of available scripting languages and engines:

  1. Groovy - built-in, via Groovy jars and <app>/lib/groovy-jsr223-xxx.jar
  2. JavaScript (Nashorn) - built-in, via Java Runtime <app>/jbr/... (deprecated and will be removed soon)
  3. JavaScript (GraalJS) - https://plugins.jetbrains.com/plugin/12548-intellij-scripting-javascript
  4. JPython - https://plugins.jetbrains.com/plugin/12471-intellij-scripting-python
  5. JRuby - https://plugins.jetbrains.com/plugin/12549-intellij-scripting-ruby
  6. Clojure - https://plugins.jetbrains.com/plugin/12469-intellij-scripting-clojure
@zach-m
zach-m / Jetty 9 + Weld 2 + Jersey 2 + Jackson 2 + Maven
Last active July 1, 2023 20:25
Jetty 9 + Weld 2 + Jersey 2 + Jackson 2 + Maven
This is a template for creating and running a Jetty web application, using Jersey + Jackson for REST, and Weld for CDI.
It is organized as a maven project, which builds a WAR file deployable to a standalone Jetty server.
The Jetty maven plugin - which is more suitable for development time - is also configured in the pom.xml.
Comments:
* As Jetty is a servlet-3.0 compatible container, no configuration is needed in web.xml
* Due to a bug in maven, it's required to use version 3.2.2 or above
* The JaxRs API classes are to be placed at the package - or below - the one where 'RestConfig.java' is
* When using in standalone Jetty installation, enable the 'cdi' module before deploying
>> java -jar start.jar --add-to-startd=cdi