Skip to content

Instantly share code, notes, and snippets.

View rehrumesh's full-sized avatar
:octocat:
👍

Rumesh Eranga Hapuarachchi rehrumesh

:octocat:
👍
View GitHub Profile
@rehrumesh
rehrumesh / App.js
Created July 5, 2020 07:39
App.js of Cats application
import React from "react";
import { Router, Route } from "react-router-dom";
import { createBrowserHistory } from "history";
import GreetingCat from "./GreetingCat";
import RandomCat from "./RandomCat";
import "./App.css";
const defaultHistory = createBrowserHistory();
function App({ history = defaultHistory }) {
import React from "react";
export default function GreetingCat(props) {
const { greeting } = props.match.params;
const greetingCatUrl = `https://cataas.com/cat/says/${greeting}`;
return (
<div>
<header>
<h3>Greet me</h3>
@rehrumesh
rehrumesh / RandomCat.js
Created July 5, 2020 07:32
RandomCat component
import React, { useState, useEffect } from "react";
export default function RandomCat() {
const [randomCatImg, setRandomCatImg] = useState(null);
const fetchRandomCat = () => {
setRandomCatImg("");
fetch(`https://aws.random.cat/meow`)
.then((res) => res.json())
.then((catInfo) => {
@rehrumesh
rehrumesh / App.js
Last active July 5, 2020 06:39
Dogs App.js
import React, { useState, useEffect } from "react";
import logo from "./logo.svg";
import "./App.css";
function App() {
const [dogImg, setDogImg] = useState(null);
const fetchDoggo = () => {
setDogImg("");
fetch(`https://dog.ceo/api/breeds/image/random`)
@rehrumesh
rehrumesh / Books.txt
Last active June 22, 2020 05:39
Recommended Reading for EL Members
Execution
============
1. The 4 Disciplines of Execution: Achieving Your Wildly Important Goals - Chris McChesney, Jim Huling, and Sean Covey
2. Measure What Matters: OKRs: The Simple Idea that Drives 10x Growth - John Doerr
3. The Phoenix Project - Gene Kim, George Spafford, and Kevin Behr
4. Project to Product: How to Survive and Thrive in the Age of Digital Disruption with the Flow Framework - Mik Kersten
Business
========
1. Hard thing about the hard things - Ben horowitz
# /etc/nginx/sites-enabled/webapp.conf:
server {
listen 80;
server_name *.coverya.no;
root /home/app/webapp/public;
client_max_body_size 4g;
location ^~ /assets/ {
allow all;
gzip_http_version 1.0;
gzip_static on;
[Unit]
Description=Keybox
After=network.target
[Service]
Type=simple
WorkingDirectory=/srv/keybox/KeyBox-jetty
ExecStart=/srv/keybox/KeyBox-jetty/startKeyBox.sh </dev/null &>/dev/null &
Restart=always
User=root
@rehrumesh
rehrumesh / test
Created June 24, 2017 07:55
Extend CentOs LVM Partition
fdisk -l
df -h
fdisk /dev/sda
n
p
enter
enter
enter
t
window.onbeforeunload = function(e) {
if (window.location.href.includes("sometext")) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Sure?';
}
// For Safari
(function (module) {
'use strict';
module.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.ngEnter);
});