I hereby claim:
- I am redconfetti on github.
- I am redconfetti (https://keybase.io/redconfetti) on keybase.
- I have a public key ASAzmSErVw9jGPNYkpArJ0XNRecBxcnAxmPoQ6V42oM7Ago
To claim this, I am signing this object:
# Often you'll have an array of hashes, and you find yourself needing to | |
# retrieve an object from that array by some unique attribute of the hash. | |
# | |
# Here is a way to convert an array to a hash that contains hashes indexed by the key value you specify. | |
# This is possible because Array uses the Enumerable module as a mixin | |
users = [ | |
{'id' => 1, 'name' => 'Susan'}, | |
{'id' => 2, 'name' => 'Pat'}, |
# It does work | |
my_hash = {a: 1, b: 2, c: 3, d: 4, e: 5} | |
my_hash.find {|k,v| puts "k:#{k},v:#{v}"; v == 3} | |
# Output: | |
# k:a,v:1 | |
# k:b,v:2 | |
# k:c,v:3 | |
# => [:c, 3] |
class ExampleClass | |
PI = 3.14159265359 | |
end |
I hereby claim:
To claim this, I am signing this object:
# Use this template by running: | |
# | |
# $ rails new my_application --api --webpack=vue -m https://gist.githubusercontent.com/redconfetti/011aac614ebe3bd7d798b431fe789f5a/raw/6b917017d2f0ede9f183107f6c9db8cf821a59b3/template.rb | |
# | |
# Configure Rspec | |
puts "-- Configuring Rspec --" | |
gem_group :development, :test do | |
gem "rspec-rails" | |
end |
These commands will work for an "owner".
JavaScript makes AJAX requests asynchronously, so you can't expect the code to wait for a return value. You have to use a callback function to process the data when it is returned.
In the past you would use a library to make HTTP requests, like jQuery, the AngularJS $http service, or the Axios library (used in older ReactJS applications).
Now JavaScript supports a new API called Fetch.
These libraries, and Fetch, return an object known as a Promise object. The Promise wraps the actual request function in a handler that enables you configure callback functions that are called upon success or failure of the request.
I wish a suite of protocols existed for the internet, much like FTP, SSH, and HTTP, to support an open distributed social network.
I'd like to adopt or contribute to such a thing. Here is a list of the requirements that I can think of that I'd set for such a suite.