Skip to content

Instantly share code, notes, and snippets.

View fmoliveira's full-sized avatar

Filipe Oliveira fmoliveira

  • Level Access
  • Toronto
  • 13:41 (UTC -04:00)
View GitHub Profile
@fmoliveira
fmoliveira / analytics.js
Created August 5, 2017 16:34 — forked from anaisbetts/analytics.js
Google Analytics in Atom Shell
// Pretend that cookies work
(function (document) {
var cookies = {};
document.__defineGetter__('cookie', function () {
var output = [];
for (var cookieName in cookies) {
output.push(cookieName + "=" + cookies[cookieName]);
}
return output.join(";");
});
@fmoliveira
fmoliveira / lazy-img.jsx
Created April 27, 2017 14:00 — forked from fdaciuk/lazy-img.jsx
React Lazy img load component
'use strict';
import React, { PropTypes, Component } from 'react';
class LazyImg extends Component {
constructor () {
super();
this.state = { loaded: false }
this.handleLoad = () => {

Keybase proof

I hereby claim:

  • I am fmoliveira on github.
  • I am fmoliveira (https://keybase.io/fmoliveira) on keybase.
  • I have a public key whose fingerprint is 21B0 2A68 7FA6 31A1 5797 51B8 977E F5B9 EA9B A75F

To claim this, I am signing this object:

@fmoliveira
fmoliveira / logstash-sentry.rb
Created April 21, 2017 16:40 — forked from clarkdave/logstash-sentry.rb
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@fmoliveira
fmoliveira / react_fiber.md
Created February 4, 2017 17:38 — forked from geoffreydhuyvetters/react_fiber.md
What is React Fiber? And how can I try it out today?
@fmoliveira
fmoliveira / Event-stream based GraphQL subscriptions.md
Created February 3, 2017 00:30 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

export const GoogleApi = function(opts) {
opts = opts || {}
const apiKey = opts.apiKey;
const libraries = opts.libraries || [];
const client = opts.client;
const URL = 'https://maps.googleapis.com/maps/api/js';
const googleVersion = '3.22';
let script = null;
@fmoliveira
fmoliveira / Codemod RN24 to RN25.md
Created November 9, 2016 13:09 — forked from sibelius/Codemod RN24 to RN25.md
Codemod React Native 24 imports to RN25 imports

README

Why this transform is necessary?

Until React Native 24, you import React from 'react-native' package, but this will change on RN 25, you will need to import React from 'react'. You probably have many files that does this, so I've created a codemod to save you a bunch of time

How to use this

  • Install jscodeshif
@fmoliveira
fmoliveira / after.sh
Created October 4, 2016 21:43 — forked from justincampbell/after.sh
Jenkins + GitHub Commit Status API
if [[ $BUILD_STATUS == "success" ]]
then
export STATUS="success"
else
export STATUS="failure"
fi
curl "https://api.github.com/repos/justincampbell/my_repo/statuses/$GIT_COMMIT?access_token=abc123" \
-H "Content-Type: application/json" \
-X POST \