This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import {default as UUID} from "node-uuid"; | |
export default function App() { | |
const [books, setBooks] = useState([]); | |
const [action, setAction] = useState('list'); | |
const [formData, setFormData] = useState({title: "", author: ""}); | |
const [currentBookId, setCurrentBookId] = useState(null); | |
const deleteBook = (id) => { setBooks(books.filter((book) => book.id != id)); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = {} | |
1.upto(20) do |page| | |
puts "page #{page}" | |
url = "https://devchat.tv/ruby-rogues/page/#{page}" | |
response = RestClient.get(url) | |
html = Nokogiri::HTML(response) | |
html.css("h3.entry-title a").map { |e| e[:href] }.each do |url| | |
response = RestClient.get(url) | |
html = Nokogiri::HTML(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = {} | |
timeouts = [] | |
1.upto(20) do |page| | |
puts "page #{page}" | |
url = "https://devchat.tv/ruby-rogues/page/#{page}" | |
response = RestClient.get(url) | |
html = Nokogiri::HTML(response) | |
html.css("h3.entry-title a").map { |e| e[:href] }.each do |url| | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# post_serializer.rb | |
class PostSerializer < ActiveModel::Serializer | |
has_many :comments | |
attributes :id, :title, :content | |
end | |
# comment_serializer.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.highlight { | |
border-radius: 5px; | |
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif; | |
font-weight: normal; | |
font-size: 15px; | |
padding: 10px; | |
padding-bottom: 0px; | |
margin-bottom: 20px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# user.rb file | |
class User | |
attr_reader :admin | |
def initialize(admin: false) | |
@admin = admin | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
def test | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'colorize' | |
class NumberService | |
def number | |
12 | |
end | |
end | |
class Describe | |
attr_reader :context_name, :examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NumberService | |
def number | |
12 | |
end | |
end | |
class Describe | |
attr_reader :context_name, :examples | |
def initialize(context_name, &block) |
NewerOlder