Skip to content

Instantly share code, notes, and snippets.

const token = 'token';
var parse = require('parse-diff');
const octokit = require('@octokit/rest')();
octokit.authenticate({
type: 'oauth',
token: token
});
async function getFiles(org, repo, prNumber) {
let result = {};
@vijayrawatsan
vijayrawatsan / merge-pr.sh
Last active June 11, 2018 10:23
Locally merge pull request
# clean repo of any unstaged, uncomiited data
cd {repoPath} && git reset --hard && git clean -d -x -f
# fetch all remote branches
cd {repoPath} && git fetch --all
# fetch pr head from remote and create a new branch named {prNumber}-{uuid}, you can generate any uuid lib or simply use date.getTime()
cd {repoPath} && git fetch origin pull/{prNumber}/head:{prNumber}-{uuid}
# checkout baseRef of the Pull Request
cd {repoPath} && git checkout {baseRef}
# fetch and merge remote data
cd {repoPath} && git pull origin {baseRef}
public abstract class TransactionAspectSupport implements BeanFactoryAware, InitializingBean {
...
...
/**
* General delegate for around-advice-based subclasses, delegating to several other template
* methods on this class. Able to handle {@link CallbackPreferringPlatformTransactionManager}
* as well as regular {@link PlatformTransactionManager} implementations.
* @param method the Method being invoked
* @param targetClass the target class that we're invoking the method on
* @param invocation the callback to use for proceeding with the target invocation
@vijayrawatsan
vijayrawatsan / TestService.java
Last active June 1, 2018 11:05
Rollback Examples
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
public class ExceptionService {
public void throwException() throws Exception {
throw new Exception("Throw me!");
}
@vijayrawatsan
vijayrawatsan / intellij-boolean-getter-setter
Last active June 8, 2020 12:32
IntelliJ boolean fields better getter setter
Use the following templates for IntelliJ 2016.1.4
Boolean isFoo;
public void getIsFoo() {
return foo;
}
public void setIsFoo(Boolean isFoo) {
this.isFoo = isFoo;
}
@vijayrawatsan
vijayrawatsan / react-create-class-live-template
Created November 20, 2015 16:14
React Create Class Live Template
var React = require('react');
var $NAME$ = React.createClass({
getInitialState: function() {
return {
};
},
componentWillMount: function() {
@vijayrawatsan
vijayrawatsan / gist:2e7e60106c95bdfde22c
Created November 5, 2015 10:05
Another possible reason to run into "only a single copy of React can be loaded at a time"
Warning: React can't find the root component node for data-reactid value `.0.2.0`. If you're seeing this message, it probably means that you've loaded two copies of React on the page. At this time, only a single copy of React can be loaded at a time.
I was rendering a jsx server side.
In my componentWillMount I was resolving a promise, which was in turn changing the state and
adding children into the render method.
Solved this by making server side componentWillMount code run synchronously.
@vijayrawatsan
vijayrawatsan / gist:c1f59fe25c7202b6e392
Created November 5, 2015 09:58
browserify babelify babel-plugin-transform-react-jsx exception
t.Identifier: Too many arguments passed. Received 3 but can receive no more than 1 while parsing
Solution:
Update to following or latest:
"babel-plugin-transform-react-jsx": "6.0.18",
"babelify": "7.2.0",
"browserify": "12.0.1",
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@vijayrawatsan
vijayrawatsan / designer.html
Created September 13, 2014 13:21
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;