Skip to content

Instantly share code, notes, and snippets.

View fabiomcosta's full-sized avatar
:octocat:
void 0

Fabio M. Costa fabiomcosta

:octocat:
void 0
View GitHub Profile
const App: () => React$Node = (props) => {
const [ players, setPlayers ] = useState([]);
useEffect(() => {
AsyncStorage.getItem('@maddness_user').then((userData) => {
getNearbyPlayers().then(performStompConnect);
}
});
}, []);
/* Polyfill service v3.27.1
* For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
*
* Features requested: IntersectionObserver,IntersectionObserverEntry,default
*
* - IntersectionObserver, License: CC0 */
(function(undefined) {
// IntersectionObserver
# Mixed css-in-js solution
Current css-in-js solutions generaly have 2 different approaches to inserting styles on the page:
1. `style` DOM nodes that have their text `innerHTML` changed
2. static style extration, where a CSS file is created from the inlined JS
`1` is good because it allows applications to support dynamic styles that have their value changed overtime, but they
require a runtime that adds some overhead to the APP and will require the browser to parse the JS code that contains the CSS rules and then the inject CSS.
`2` is good because it allows developers to ship CSS directly to the browser, without the runtime cost.
@fabiomcosta
fabiomcosta / .flowconfig
Last active July 26, 2020 04:45
Fixing immutable 3.8 Flow types without having to upgrade to v4
[ignore]
.*/node_modules/immutable/.*
function x() {
if (foo) {
return foo;
}
if (bar) {
retur bar;
}
return baz;
}
const elementWithRef = shallow(<Component/>).find('<the-ref-element>');
elementWithRef.prop('ref')({ getBoundingClientRect: () => ({ width: 12, ... })});
// do things that would use the ref you just set
# Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
/*!{id:msgpack.js,ver:1.05,license:"MIT",author:"[email protected]"}*/
// === msgpack ===
// MessagePack -> http://msgpack.sourceforge.net/
this.msgpack || (function(globalScope) {
globalScope.msgpack = {
pack: msgpackpack, // msgpack.pack(data:Mix,
// toString:Boolean = false):ByteArray/ByteString/false
@fabiomcosta
fabiomcosta / robot.js
Created December 1, 2012 03:21
Eh nozes
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@fabiomcosta
fabiomcosta / robot.js
Created December 1, 2012 01:26 — forked from cezarsa/robot.js
Kaiju Banzai
function Robot(robot) {}
Robot.status = 0;
Robot.enemy = {};
Robot.enemy.posX;
Robot.enemy.posY;
Robot.enemy
// well, we need to do something...
// whenever our robot is idle, this method gets called.
Robot.prototype.onIdle = function(ev) {