Skip to content

Instantly share code, notes, and snippets.

View sebastialonso's full-sized avatar

Sebastián González sebastialonso

View GitHub Profile
@sebastialonso
sebastialonso / gist:0df73421dd4184e8de69893391cf91ff
Created October 1, 2018 14:03
t080_template_asisgnación_de_responsabilidad
Incluir acá la meta semanal del equipo
Subequipo (pinnear a cada miembro del subequipo anteponiendo "@")
-------------------------------------------------
* Responsabilidad 1
* Responsabilidad 2
* Responsabilidad N
@sebastialonso
sebastialonso / nested_aggs.sh
Created March 13, 2018 21:14
Nested aggregation
curl -X POST -H 'Content-Type: application/json' http://localhost:9200/data-obj/data-obj/_search?size=0&pretty -d '
{
"aggs": {
"range_agg": {
"range": {
"field": "age",
"ranges": [
{"to": 20},
{"from": 20, "to": 25},
{"from": 25, "to": 30},
@sebastialonso
sebastialonso / aggs.sh
Last active March 13, 2018 21:10
Aggregation in Elastic
curl -X POST -H 'Content-Type: application/json' http://localhost:9200/data-obj/data-obj/_search?size=0&pretty -d '
{
"aggs": {
"range_agg": {
"range": {
"field": "age",
"ranges": [
{"to": 20},
{"from": 20, "to": 25},
{"from": 25, "to": 30},
@sebastialonso
sebastialonso / Guardian JWT.md
Created November 3, 2017 18:37 — forked from nikneroz/Guardian JWT.md
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

{
type: 'GET_ISSUES',
payload: [{ title: 'Login doesnt work!', author_id: 3 }, { title: 'Weird error on toolbar', author_id: 3 }]
}
import React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getIssues} from '../actions/issues_actions'
class IssuesIndex extends React.Component {
render() {
return <div>Yay</div>
}
import Request from 'superagent';
export function getIssues() {
const request = Request
.get('http://issues.com/issues')
return (dispatch) => {
request.end((err, res) => {
if (res.ok)
dispatch({
type: 'GET_ISSUES',
export default function(state = null, action) {
switch(action.type) {
case 'GET_ISSUES':
return action.payload;
}
return state;
}
import {combineReducers} from 'redux';
import IssuesReducer from './issues/issues_reducer';
const rootReducer = combineReducers({
issues: IssuesReducer
});
export default rootReducer;
@sebastialonso
sebastialonso / 2.js
Created December 4, 2016 19:52
Router_middleware
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import allReducers from './reducers/root_reducer';
let createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
const RouterComponent = (props) => {
const routes = (