Skip to content

Instantly share code, notes, and snippets.

View steevehook's full-sized avatar
📖
redefining education

Steve Hook steevehook

📖
redefining education
View GitHub Profile
import {withRouter} from 'react-router-dom';
class App extends React.Component {
constructor() {
super();
this.state = {path: ''}
}
componentDidMount() {
let pathName = this.props.location.pathname;
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
}
increment = () => {
this.setState(prevState => {
@matryer
matryer / quiz.go
Last active October 22, 2018 23:08
golanguk.com quiz
package main
import (
"fmt"
)
/*
Question:
What will be printed by this program?
@RomkeVdMeulen
RomkeVdMeulen / prop-decorator.ts
Last active June 26, 2020 14:01
How to change instance properties through decorators in TypeScript: http://romkevandermeulen.nl/2018/01/24/typescript-property-decorators.html
function makePropertyMapper<T>(prototype: any, key: string, mapper: (value: any) => T) {
const values = new Map<any, T>();
Object.defineProperty(prototype, key, {
set(firstValue: any) {
Object.defineProperty(this, key, {
get() {
return values.get(this);
},
set(value: any) {
values.set(this, mapper(value));
@brenopolanski
brenopolanski / npm-list-globally.md
Created November 1, 2016 19:34
Listing globally installed NPM packages and version
npm list -g --depth=0
@tomysmile
tomysmile / brew-java-and-jenv.md
Last active April 20, 2022 16:14
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

Install cask that extends the brew command :

brew install phinze/cask/brew-cask

Install calibre using cask :

brew cask install calibre
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!