emacs --daemon to run in the background.
emacsclient.emacs24 <filename/dirname> to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
- Undo -
C-/ - Redo -
C-? - Change case: 1. Camel Case :
M-c2. Upper Case :M-u
- Lower Case :
M-l
| #!groovy | |
| # Best of Jenkinsfile | |
| # `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
| node { | |
| } |
| node { | |
| // https://registry.hub.docker.com/_/maven/ | |
| def maven32 = docker.image('maven:3.2-jdk-7-onbuild'); | |
| stage 'Mirror' | |
| // First make sure the slave has this image. | |
| // (If you could set your registry below to mirror Docker Hub, | |
| // this would be unnecessary as maven32.inside would pull the image.) | |
| maven32.pull() | |
| // We are pushing to a private secure docker registry in this demo. |
| # create a docker machine and run the registry on it | |
| docker-machine create -d virtualbox box1 | |
| docker $(docker-machine config box1) run -d -p 5000:5000 --restart=always --name registry registry:2 | |
| # create the second docker machine referencing the insecure registry | |
| docker-machine create -d virtualbox --engine-insecure-registry $(docker-machine ip box1):5000 box2 | |
| # on the second docker machine pull an image, login to the insecure registry (entry any login/password), tag, push the image, and then run the image | |
| docker $(docker-machine config box2) pull alpine | |
| docker $(docker-machine config box2) login $(docker-machine ip box1):5000 |
| // inspired from: https://discuss.gradle.org/t/generated-eclipse-classpath-can-contain-duplicate-entries/15273/3 | |
| // Workaround to eliminate duplication eclipse classpath entries, it | |
| // just takes the first entry if there are duplicates | |
| eclipse { | |
| classpath { | |
| file { | |
| whenMerged { cp -> | |
| logger.lifecycle "Removing duplicate classpath entries from eclipse for project '${project.name}'" |
| /* | |
| What happens? | |
| - `new Type().what` is looked up with a call to `get` on the proxy | |
| - a function is returned that will look up `METHOD_NAME` when called | |
| - `METHOD_NAME` is called because of the `()` behind `new Type().what` | |
| - if `METHOD_NAME` exists on you object, your own function is called | |
| - if not, because of prototypal inheritance, `get` is called again | |
| - `name` is now `METHOD_NAME` and we can throw as we know `METHOD_NAME` is not implemented on the type | |
| credits http://soft.vub.ac.be/~tvcutsem/proxies/ |
| #!/usr/bin/env groovy | |
| // python version: | |
| // python -m http.server [<portNo>] | |
| import org.eclipse.jetty.server.Server | |
| import org.eclipse.jetty.servlet.* | |
| import groovy.servlet.* | |
| @Grab(group='org.eclipse.jetty.aggregate', module='jetty-all', version='7.6.15.v20140411') | |
| def startJetty() { |
emacs --daemon to run in the background.
emacsclient.emacs24 <filename/dirname> to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
C-/C-?M-c
2. Upper Case : M-uM-l| var json = '...'; // your truncated json data here | |
| var chunk = json; | |
| var m, q = false; | |
| var stack = []; | |
| while (m = chunk.match(/[^\{\[\]\}"]*([\{\[\]\}"])/)) { | |
| switch (m[1]) { | |
| case '{': |
This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.
| function toJSON(node) { | |
| node = node || this; | |
| var obj = { | |
| nodeType: node.nodeType | |
| }; | |
| if (node.tagName) { | |
| obj.tagName = node.tagName.toLowerCase(); | |
| } else | |
| if (node.nodeName) { | |
| obj.nodeName = node.nodeName; |