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
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
}
increment = () => {
this.setState(prevState => {
import {withRouter} from 'react-router-dom';
class App extends React.Component {
constructor() {
super();
this.state = {path: ''}
}
componentDidMount() {
let pathName = this.props.location.pathname;
@dideler
dideler / bot.rb
Last active April 17, 2024 08:40
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@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));
@creack
creack / main.go
Created January 7, 2018 17:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 9, 2024 18:54
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@BretFisher
BretFisher / pcat-install.sh
Last active February 6, 2024 14:41
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@brenopolanski
brenopolanski / npm-list-globally.md
Created November 1, 2016 19:34
Listing globally installed NPM packages and version
npm list -g --depth=0
@blixt
blixt / logger_middleware.go
Last active April 2, 2024 18:52
Logger middleware for Go HTTP servers which logs every request with response status code in the Apache format.
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"time"
)