Tagged Questions
4
votes
1answer
56 views
Ruby command-line app that outputs from JSON file
I made this application that runs fine, but I feel the code is sloppy as there are many if statements. I'm a beginner so I'm not sure how to improve it, at least not without messing everything up. Any ...
3
votes
1answer
78 views
Rails 5 controller to get information about Steam users
I've done a bit of modifications and finally got it working, and did a lot of reading about @ vs @@ vs just declaring and I came ...
1
vote
0answers
45 views
Converting ActiveRecord array to JSON
I have two tables, devices and device_properties.
The devices table columns are as follows:
...
3
votes
1answer
485 views
Testing a Rails API controller
I'm building a JSON API. I'm writing my controller tests so that they compare the response body to actual JSON I'm generating in my tests using ActiveRecord. I wrote two helper methods that make the ...
2
votes
2answers
269 views
Parsing JSON string from HTTP request
HTTP request is made, and a JSON string is returned, which needs to be parsed.
Example response:
...
4
votes
1answer
47 views
Consolidating a raw csv of two ids to grouped set of ids in json
The file I'm processing here is an outputted file from a Java library called duke.
Its goal was go through all purchases made on a site and group them into a single customer. The output is a csv ...
3
votes
1answer
51 views
Song search app with dynamic tables
I decided to make a Ruby app to search for songs, which uses the tinysong API. Things got really cryptic and weird in the view. I managed to get dynamic tables that adjust to data length, but I feel ...
2
votes
0answers
787 views
PDF-to-JSON converter
I've created some methods to help me convert PDF to text and then text to a JSON object. I've never done this before and I'm using this exercise as a way to improve my knowledge of Ruby.
The ...
2
votes
0answers
84 views
Improving JavaScript processing of Ruby Regex
I have a basic webapp that basically serves the same purpose as Rubular.com, but for gsub.
It runs some simple JavaScript, which POST's to a Sinatra app, which then updates page with the results.
<...
2
votes
1answer
40 views
Displaying shows with videos
My method takes a long time to respond, so I'd like to make this method more efficient. I'd also like this method made with joins.
...
2
votes
2answers
2k views
Deserialize JSON Strings Directly into Models?
I have Ruby models which are populated from the responses of API calls in the following way:
JSON.parse converts the response to a ...
4
votes
1answer
111 views
Refactor Ruby code from Hacker News API. Trouble parsing the JSON data
I made a command line Hacker News reader in Ruby that pulls the latest 10 stories from HN and allows the user to cycle through them or open them with Launchy. This was to play around with Ruby and ...
2
votes
1answer
146 views
Filtering Pinboard API results by tags
I've got a simple sinatra webapp that pulls data from Pinboard's RSS api, parses the info, and re-displays it. There are 4 tasks I need to perform with the data:
I need to remove all instances of a ...
4
votes
1answer
408 views
Testing Backbone.js
I'm writing a (nearly-)single-page app using Ruby on Rails 3.1 and Backbone.js. Thus, most of my controllers return rootless JSON, courtesy this setting as per the Backbone.js docs:
...