Skip to content

Instantly share code, notes, and snippets.

Fabio M. Costa fabiomcosta

Block or report user

Report or block fabiomcosta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:01ff57fd99ee1be1ca1664b55716bb25
/* 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
View README
# 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 Apr 8, 2019
Fixing immutable 3.8 Flow types without having to upgrade to v4
View .flowconfig
[ignore]
.*/node_modules/immutable/.*
View gist:d77f1ae7918a11ae475c575b8957c812
function x() {
if (foo) {
return foo;
}
if (bar) {
retur bar;
}
return baz;
}
View gist:cf71bab308ba0072a94c4401f85510e7
const elementWithRef = shallow(<Component/>).find('<the-ref-element>');
elementWithRef.prop('ref')({ getBoundingClientRect: () => ({ width: 12, ... })});
// do things that would use the ref you just set
View cson
# 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:
View msgpack.js
/*!{id:msgpack.js,ver:1.05,license:"MIT",author:"uupaa.js@gmail.com"}*/
// === msgpack ===
// MessagePack -> http://msgpack.sourceforge.net/
this.msgpack || (function(globalScope) {
globalScope.msgpack = {
pack: msgpackpack, // msgpack.pack(data:Mix,
// toString:Boolean = false):ByteArray/ByteString/false
View robot.js
//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 Dec 1, 2012 — forked from cezarsa/robot.js
Kaiju Banzai
View robot.js
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) {
View robot.js
//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.rotateCannon(360);
You can’t perform that action at this time.