We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Let's generate User model and controller.
# 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 |
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; |
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 }] | |
} |