Skip to content

Instantly share code, notes, and snippets.

View kulakowka's full-sized avatar

Anton Kulakov kulakowka

  • Tbilisi, Georgia
View GitHub Profile
@kulakowka
kulakowka / git-rev.js
Created January 24, 2019 12:50
Getting a commit hash in node.js
const git = require("git-rev-sync");
console.log(git.short());
// 75bf4ee
console.log(git.long());
// 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef
console.log(git.branch());
// master
type Query {
viewer: User
feed: [Lesson]!
file(id: ID!): File!
lesson(id: ID!): Lesson!
lessons(
skip: Int = 0
limit: Int = 10
function createFeedBack(root, { input }, { viewer, errors: { AuthenticationError } }) {
if (!viewer) throw new AuthenticationError("must authenticate");
return viewer.createFeedBack(input);
}
const {
ApolloServer,
ForbiddenError,
AuthenticationError,
UserInputError
} = require("apollo-server-express");
const requireDirectory = require("require-directory");
const { readFileSync } = require("fs");
const db = require("../db");
const resolvers = requireDirectory(module, "./resolvers");
// Static methods
User.create()
User.remove()
User.update()
User.signIn()
User.findByToken()
User.findByEmail()
// Instance methods
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+0",
"command": "workbench.action.openLastEditorInGroup"
},
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
@kulakowka
kulakowka / devtools.js
Created August 13, 2018 00:33
react debug component
var devtools = /./;
devtools.toString = function() {
this.opened = true;
};
console.log("%c", devtools);
// devtools.opened will become true if/when the console is opened
export default props => {
{
"Ansi 5 Color" : {
"Red Component" : 0.98751437664031982,
"Color Space" : "Calibrated",
"Blue Component" : 0.70531737804412842,
"Alpha Component" : 1,
"Green Component" : 0.29879066348075867
},
"Tags" : [

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file:

// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};