Skip to content

Instantly share code, notes, and snippets.

View Prkns's full-sized avatar
🥔
Building something... Probably!

David Perkins Prkns

🥔
Building something... Probably!
View GitHub Profile
@Prkns
Prkns / useKeypress.js
Created July 13, 2021 16:29
Esc keypress react hook
import { useEffect } from "react";
export default function useKeypress(key, action) {
useEffect(() => {
function onKeyup(e) {
if (e.key === key) action();
}
window.addEventListener("keyup", onKeyup);
return () => window.removeEventListener("keyup", onKeyup);
}, []);

Keybase proof

I hereby claim:

  • I am prkns on github.
  • I am prkns (https://keybase.io/prkns) on keybase.
  • I have a public key ASDlCqGvv2DGzJxVkDh-vP9MeKPttE8PbKUVIsOuwrnsaAo

To claim this, I am signing this object:

@Prkns
Prkns / clip.html
Created February 14, 2017 09:45
SVG ClipPath
<style type="text/css">
#clip {
clip-path: url(#gradBars);
}
</style>
<div id="clip">
<img class="svg-clipped" src="http://lorempixel.com/600/600/sports/">
</div>
@Prkns
Prkns / site.php
Created January 30, 2017 11:04
Concrete 5 Site Config
<?php
if($_SERVER['HTTP_HOST'] == 'domain.com') { // Live domain
define('DB_SERVER', 'localhost'); // Live DB Server
define('DB_USERNAME', 'username'); // Live DB Username
define('DB_PASSWORD', 'password'); // Live DB Password
define('DB_DATABASE', 'database-name'); // Live DB Name
define('PASSWORD_SALT', 'password-salt'); // C5 Password Salt
} else {
define('DB_SERVER', 'localhost'); // Local DB Server
define('DB_USERNAME', 'username'); // Local DB Username