Skip to content

Instantly share code, notes, and snippets.

🐢
.

Jean Carlo Emer jcemer

🐢
.
Block or report user

Report or block jcemer

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
@jcemer
jcemer / angular-test-helper-usage.ts
Last active Apr 2, 2018
Let's make your life better testing Angular like writing jQuery code. It's inspired by https://github.com/airbnb/enzyme.
View angular-test-helper-usage.ts
describe('Component', () => {
let wrapper;
beforeEach(() => {
wrapper = build(Component);
wrapper.set({
data: 'value',
});
});
View runtime-type-validation.js
/* @flow */
import typify from "typify"
class Ok<A> {
value: A
constructor(value: A) {
this.value = value
}
}
View Reactive Conf - Thinking metrics on React applications.md

This is a proposal for a lightning talk at the Reactive 2016 conference. If you like this, star the Gist.


Thinking metrics on React applications

In regular websites, it is common to send multiple events to track user clicks. Single Page Applications change the way you look at metrics. This is a talk about a simple pattern we created at Globo.com to manage a metrics layer for http://globoplay.globo.com. The talk will cover how to track user flow using Google Analytics and other services. We solved the challenge of tying metrics and components, keeping information across pages and having global data. Also some React, React Router and React Side Effects concepts like context, higher order components, history state will be covered.

View Playing with node vm.js
var vm = require('vm')
var sandbox = {externalArray: [], externalArryConstructor: Array}
vm.createContext(sandbox)
console.log(vm.runInContext('externalArryConstructor == Array', sandbox))
console.log(vm.runInContext('externalArray.constructor == Array', sandbox))
console.log(sandbox.externalArray.constructor == Array)
console.log(vm.runInContext('externalArray.__proto__ == [].__proto__', sandbox))
@jcemer
jcemer / add.js
Created Jul 8, 2014
Browserify sample
View add.js
module.exports = function (a, b) {
return a + b;
};
View code.scss
.section-title {
font-size: rem(28px);
color: $blue;
@include inverse-bottom-line(80%);
}
.collaborate-item:last-child {
@include left-line(90%);
padding-left: 10%;
}

.address-map {
@jcemer
jcemer / gist:5400404
Last active Dec 16, 2015
Count repeated words.
View gist:5400404
# it parses "a a a a b b b c c" to {"a"=>4, "b"=>3, "c"=>2}
# FROM
def self.estatisticas_do_texto(texto)
palavras = []
texto.split(' ').each do |word|
w = word.downcase.gsub(/\.|\,|\?|\!|\(|\)|\'/,'')
palavras << w
end
palavras.sort!
@jcemer
jcemer / gist:4324878
Created Dec 18, 2012
No country for old men
View gist:4324878
var x = 2
with ({x:3}) {
console.log(x)
}
@jcemer
jcemer / robot.js
Created Dec 4, 2012 — forked from cezarsa/robot.js
Simple Wall Robot
View robot.js
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
robot.turnGunRight(90);
robot.clone();
this.direction = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(1);
if (robot.parentId) {
You can’t perform that action at this time.