Skip to content

Instantly share code, notes, and snippets.

View peterj's full-sized avatar
🌟
....

Peter Jausovec peterj

🌟
....
View GitHub Profile
@peterj
peterj / createpr.sh
Created July 10, 2017 17:45
Script for creating PR on VSTS (used in SourceTree as a custom action)
#!/bin/bash
targetBranch="master"
origin=$(git remote get-url origin)
branch=$(git rev-parse --abbrev-ref HEAD)
prurl="$origin/pullrequestcreate?sourceRef=$branchName&targetRef=$targetBranch"
open $prurl
@peterj
peterj / bash-template.sh
Last active June 25, 2018 16:42
Bash script template
#!/bin/bash
set -eo pipefail
IFS=$'\n\t'
readonly LOG_FILE="/tmp/$(basename "$0").log"
info() { echo "[INFO] $*" | tee -a "$LOG_FILE" >&2 ; }
warning() { echo "[WARNING] $*" | tee -a "$LOG_FILE" >&2 ; }
error() { echo "[ERROR] $*" | tee -a "$LOG_FILE" >&2 ; }
fatal() { echo "[FATAL] $*" | tee -a "$LOG_FILE" >&2 ; exit 1 ; }

Keybase proof

I hereby claim:

  • I am peterj on github.
  • I am peterj (https://keybase.io/peterj) on keybase.
  • I have a public key ASBVqcnsOsFuaLoqTSmaYjbWPbnfJ0hcBMnasetTKZPivwo

To claim this, I am signing this object:

@peterj
peterj / Dockerfile
Last active April 4, 2020 21:47
React app Dockerfile
FROM mhart/alpine-node:11 AS builder
WORKDIR /app
COPY . .
RUN yarn run build
FROM mhart/alpine-node
RUN yarn global add serve
WORKDIR /app
COPY --from=builder /app/build .
CMD ["serve", "-p", "80", "-s", "."]
const STRIPE_KEY="sk_test_STRIPE_KEY";
const configureStripe = require('stripe');
const stripe = configureStripe(STRIPE_KEY);
stripe.charges.create(req.body, function (err, res) {
if (err) {
context.res = { status: 400, body: err};
} else {
context.res = { status: 200, body: res };
}
const stripe = require('stripe')('sk_STRIPE_KEY');
stripe.charges.create({
description: 'charge description',
source: 'token_id',
currency: 'USD',
amount: 999
}, (err, res) => {
// send success/error response back
});
<ul>
</nav>
</dl>
aliqua. Ut
uat.</dd>
<ul>
aliqua. Ut </dl>
@peterj
peterj / Link.js
Last active December 28, 2017 20:34
Link.js file for the tutorial
import React, { Component } from 'react';
import LinkList from './components/LinkList';
class App extends Component {
render() {
return <LinkList />;
}
}
export default App;