Skip to content

Instantly share code, notes, and snippets.

View victorfern91's full-sized avatar
🐊

Victor Fernandes victorfern91

🐊
View GitHub Profile
star numTimes
1 102
2 142
3 145
4 107
5 92
6 126
7 111
8 118
9 108
number numTimes
1 66
2 70
3 74
4 58
5 74
6 67
7 67
8 61
9 71
@victorfern91
victorfern91 / keybase.md
Last active November 2, 2020 12:49
keybase.md

Keybase proof

I hereby claim:

  • I am victorfern91 on github.
  • I am victorferntd (https://keybase.io/victorferntd) on keybase.
  • I have a public key ASAZ_MDt1BNVijfPy0im63xNkRsRoTbvPDwIff-ub8Bgfgo

To claim this, I am signing this object:

@victorfern91
victorfern91 / canvas.js
Last active February 7, 2022 10:16
Buffered canvas
class Canvas {
constructor(width = 400, height = 400, options = { appendCanvas: true }) {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
this.context = canvas.getContext('2d');
this.element = canvas;
if (options.appendCanvas) {

Keybase proof

I hereby claim:

  • I am victorfern91 on github.
  • I am victorferntd (https://keybase.io/victorferntd) on keybase.
  • I have a public key ASBDlPPBw81xuqyguYs4XhYoSfx4Cp1cIvtUT8rgiWqYLwo

To claim this, I am signing this object:

* _
* / _\ | WARNING:
* / \/ \ |
* /__o___\ |
* ||
*
.base-component {
/* base style for this component and it will work for any screen size */
}
.sm > .base-component {
/* style that will be applied in this component for small sizes */
}
.md > .base-component {
/* style that will be applied in this component for medium sizes */
@victorfern91
victorfern91 / responsiveComponentHoc.js
Last active July 11, 2018 13:09
React responsive components
function withResizeObserver(Component, responsiveLimits = { sm: 540, md: 720, lg: 960, xl: 1200 }) {
return class extends React.Component {
constructor() {
super();
this.state = {
width: 0,
componentDimension: "sm"
};
}
// private data
var _events = {};
// public 'interface'
var EventHub = {
on: function (eventName, callback) {
_events[eventName] = _events[eventName] || [];
_events[eventName].push(callback);
},
off: function (eventName, callback) {