Skip to content

Instantly share code, notes, and snippets.

Cristiano Oliveira criso

Block or report user

Report or block criso

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 keybase.md

Keybase proof

I hereby claim:

  • I am criso on github.
  • I am cris_o (https://keybase.io/cris_o) on keybase.
  • I have a public key ASDj-vj41D6LRTA8W5IbAbIeo5TQLfZzWh8jh5QOSSjkngo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am criso on github.
  • I am cris_o (https://keybase.io/cris_o) on keybase.
  • I have a public key ASB1XaCZX-wQmkAKvqx8EAq99cRXq2JRfXXWdKjK59ciogo

To claim this, I am signing this object:

View React-motion.js
const tabBtns = this.state.tabs.map((tab, index) => {
const tabKey = tab.key;
const style = this.buildMotionStyle(tabKey);
const isActive = this.props.selectedTabKey === tabKey;
return (
<Motion style={style} key={index}>
{
({scale, x, cursor, zIndex}) => {
return React.cloneElement(tab, {
@criso
criso / gist:086881ec8df844eda73a
Last active Aug 29, 2015
Flux dispatcher issues
View gist:086881ec8df844eda73a
// Scenario:
// Compnonent BAR requests data from the server via an action `REQ_BAR`
// Component FOO receives data from a previous request `REQ_FOO_SUCCESS`
// --- Cannot dispatch in the middle of a dispatch. --- error is triggered
// `WaitFor` doesn't seem right, since the stores for these two components aren't related e.g:
// The store used for component FOO does not need any data from the store used for component BAR
// ActionsCreators
// ===================
var ActionCreators = {
View component.js
// Search form component
window.Ui = window.Ui || {};
Ui.SearchForm = (function() {
return flight.component(SearchForm);
function SearchForm() {}
}());
// validation mixin
View batch-test.js
function randomTime() {
return Math.floor(Math.random() * 100) + 100;
}
function asyncFoo(_callback) {
var err = false;
setTimeout(function() {
_callback({foo: "I am foo"}, err);
}, randomTime());
@criso
criso / time-it.c
Last active Dec 10, 2015
Calculate function execution time
View time-it.c
#include <time.h>
#include "lib/dbg.h"
void my_function() {
}
int main (int argc, char const* argv[]) {
clock_t begin, end;
double time_spent;
@criso
criso / dbg.h
Created Dec 24, 2012
Zed's debug macros in color
View dbg.h
#ifndef __dbg_h__
#define __dbg_h
#include <stdio.h>
#include <errno.h>
#include <string.h>
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_YELLOW "\x1b[33m"
View sql-the-things.sql
-- Set Root Password
mysqladmin -u root password <YOURNEWPASSWORD>
-- Set / Change MySQL Users Passwords from the Linux Shell
mysqladmin -u <username >-h <host> -p password <newpassword>
-- How To Connect to MySQL
mysql -ur <username> -p
mysql -h <hostname> -u <username> -p
@criso
criso / separat-context.js
Created Nov 16, 2012
context separation @ded style
View separat-context.js
(function () {
with (this) {
!function (context) {
context.hello = function (msg) {
alert(msg);
};
You can’t perform that action at this time.