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 / ygyl.py
Last active July 27, 2016 18:31
YGYL automatic downloader (py2)
import requests, json
CATALOG_URL = 'http://a.4cdn.org/gif/catalog.json'
THREAD_URL = 'http://a.4cdn.org/gif/thread/'
CDN_URL = 'http://i.4cdn.org/gif/'
CRITERIA = 'YGYL'
files_saved = 0
def parse_thread(number):
global files_saved
package com.seba.sqltutorial.Handlers;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.seba.sqltutorial.Models.Shop;
@sebastialonso
sebastialonso / Virtualenv
Last active August 18, 2016 18:40
Create a virtualenv with Tornado
# Install virtualenv
sudo pip install virtualenv
# Create the virtual envorinment
virtualenv --no-site-package app (# to use python3.5: `-p python3.5`)
# Install tornado in the virtual environment
app/bin/pip tornado
# After that, the following command should show something like tornado-VERSION-.egg
@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 = (
import {combineReducers} from 'redux';
import IssuesReducer from './issues/issues_reducer';
const rootReducer = combineReducers({
issues: IssuesReducer
});
export default rootReducer;
export default function(state = null, action) {
switch(action.type) {
case 'GET_ISSUES':
return action.payload;
}
return state;
}
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',
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>
}
{
type: 'GET_ISSUES',
payload: [{ title: 'Login doesnt work!', author_id: 3 }, { title: 'Weird error on toolbar', author_id: 3 }]
}
@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.