Skip to content

Instantly share code, notes, and snippets.

View mazikwyry's full-sized avatar
🍔

Adam Mazur mazikwyry

🍔
  • Global App Testing
  • Wyry
View GitHub Profile
@mazikwyry
mazikwyry / user.rb
Last active June 13, 2017 07:32
User model
class User < ApplicationRecord
devise :database_authenticatable,
:jwt_authenticatable,
jwt_revocation_strategy: JWTBlacklist
end
return (
<section className="discover">
<DiscoverHeader />
{!isAdvancedSearchVisible && <DiscoverForm actions={actions} />}
{isAdvancedSearchVisible && <DiscoverAdvancedForm actions={actions} />}
{projectsWeLove.size !== 0
&& projects.size === 0
&& !wasSearchPerformed
&& <DiscoverProjectsWeLove actions={actions} />}
{!wasSearchPerformed && topProjectsHTML}
require 'opal'
require 'jquery'
require 'opal-jquery'
require 'json'
require 'react-latest'
require 'reactrb'
require 'todo'
require 'todo_store'
def add_todo(body)
$store.dispatch({
type: :add_todo,
id: 1,
body: body
})
end
class ToDoStore
attr_reader :state
def initialize(initial_state = nil)
@state = initial_state
@listeners = []
dispatch({})
end
def dispatch(action)
class ToDoBox < React::Component::Base
param :todos, type: Array
def add_todo(body)
$store.dispatch({
type: :add_todo,
id: 1,
body: body
})
end
class ToDoList << React::Component::Base
param :todos, type: Array
render do
params.todos.each do |todo|
ToDoElement(todo: todo)
end
end
end
class ToDoForm < React::Component::Base
param :add_todo, type: Proc
define_state body: ''
render do
div do
div do
input(type: :text, value: state.body)
.on(:change) { |e| state.body! e.target.value }
class ToDo
attr_accessor :body, :id
def initialize(id, body)
@body = body
@id = id
end
end
class ToDo
attr_accessor :body, :id
def initialize(id, body)
@body = body
@id = id
end
end