Skip to content

Instantly share code, notes, and snippets.

View saurabh-sp-tripathi's full-sized avatar

saurabh-sp-tripathi

View GitHub Profile
@saurabh-sp-tripathi
saurabh-sp-tripathi / nodejs-cookbook.md
Last active July 2, 2018 18:45
quick reference for a quick start of nodejs project
  • npm init
  • npm install mocha --save-dev
  • mpm install chai --save-dev
  • npm install should --save-dev

If web

  • npm install request --save-dev
var should = require("should");
var request = require("request");
var expect = require("chai").expect;
@saurabh-sp-tripathi
saurabh-sp-tripathi / win-cmd.md
Last active July 2, 2018 20:32
This is list of productive (for me) alias for windows machine

Vim task

  • write something "file1", "file2".... or
"uid1",
"uid2",
"uid3",
"uid4",
"uid5",
"uid6",
"uid7",
@saurabh-sp-tripathi
saurabh-sp-tripathi / git-intro.md
Created July 13, 2018 21:23
A brief Git introduction

Why Git:

  • Local and distributed :
    • So what?
    • Local is faster : Think about it, reading from HDD/RAM is faster than reading from www.imslow.com each time.
    • It not only saves your time on local operations like read history, diff, work offline [-who doesn’t have internet??] but also makes collaborating tools like Jenkins faster to act.
  • Branch policies & Code review (GitHub, GitLap, VSTS ets): Tools made upon git have eligant feature like
    • Code review: Following pull request workflow (more on this later), you can set branch policies to make sure that a code is reviewed before getting into the branch.
    • Branch policies to prevent anyone directly committing into the branch like prod branch 'master' (similar to trunk)
  • Lightweight:
  • Git's repositories are much smaller than Subversions (for the Mozilla project, 30x smaller). ref: https://git.wiki.kernel.org/index.php/GitSvnComparison

Set build number of a job: Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)

@saurabh-sp-tripathi
saurabh-sp-tripathi / intellij-cmd.md
Last active August 2, 2018 18:27
Intellij shortcut keys
  • Search action/command : ctrl + shift + a
  • switch vim : alt + T => ctrl + alt + v
  • methods : ctrl+F12
  • goto line : ctrl + g
  • select and paste recent clipboard: ctrl+shift+v
  • back and forth curson ctrl + alt + <- or ->

Fresh set up

  • cancel action : C-g
  • query/replace in selected : C-<space> select region >>> M-x >> replace-string >> ....
  • copy/cut paste : M-w/C-w C-y
  • del i.e kill line: M-x
  • list bufferes : C-x C-b ; close it : C-x 1
  • Switch buffers : C-x b or select from C-x C-f
  • Save all buffer : C-x s this will ask you for all unsaved buffer
  • File ops [todo: anything from below if repeated above, delete the above one]
	C-x C-f		Find file
  • file{begin,end}  : `gg, G`
    
  •  line{begin, end} : `0, $`
    
  •               Undo: `u`
    
  •  Select,copy,paste: `Vyp` (weep) 
    
  •  Select,cut,paste: `Vdp` (we dip)
    
  •  show line number : `:set number` ; hid : `set nonumber`
    
  • move cursor previous pos: ``

#File explorer

  • :set wildmenu >> :set path+=** >> :find <tab>

match anything : .* eg: regex \(.*\) matches (a, b, c, d) or (a..dlldkfjdlkjaoi) or (9788E98e7r8e((&^&*^&)

  • find & replace
PaymentByCard.nameOfBrowser.equalsIgnoreCase\(("[a-z]*")\)
$1.equalsIgnoreCase(browserName)
==> "chrome".equalsIgnoreCase(browserName)

@saurabh-sp-tripathi
saurabh-sp-tripathi / ParamSetListBuilder.java
Created August 14, 2018 20:18
a temp gist, this code is used in testng to create combination of parameter in dataProvider
public static class ParamSetListBuilder {
private List<List> paramList = new ArrayList<>();
private Logger logger = LoggerFactory.getLogger(getClass());
public ParamSetListBuilder addParams(List paramListToCombine) {
addParamsAtIndex(paramListToCombine, Helper.calcParamIndex(paramList));
return this;
}