Skip to content

Instantly share code, notes, and snippets.

Avatar

Parth Desai parthdesai93

View GitHub Profile
@parthdesai93
parthdesai93 / crowdlinker-dog.js
Created Mar 29, 2016
a ‘dog’ object has the value of legs = 4. Create a new var named ‘fido’ as a ‘dog’ object. Set fido’s age as ‘3’ and output the number of legs that ‘fido’ has.
View crowdlinker-dog.js
var dog = {
legs: 4
};
var fido = Object.create(dog);
fido.age = 3; //can define fido['age'] = 3; as well
console.log('Fido has : ' + fido.legs + ' legs!');
@parthdesai93
parthdesai93 / crowdlinker-styles.css
Created Mar 29, 2016
Write the CSS for the following: A div with class “navbar”, when nested inside a div with id “header”, should have a width of 100px, a left padding of 10px, and always be visible at a fixed position 30 pixels from the top of the window.
View crowdlinker-styles.css
div#header > div.navbar{
width: 100px;
padding-left: 10px;
visibility: visible;
position: fixed;
top: 30px;
}
@parthdesai93
parthdesai93 / oauth_error.log
Created Aug 8, 2016
rails soundcloud backtrace
View oauth_error.log
NoMethodError (undefined method `access_token' for #<HTTParty::Response:0x007f10c16b0930>):
app/controllers/soundcloud_controller.rb:20:in `connected'
Rendering /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.6ms)
Rendering /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.9ms)
Rendering /home/parth/.rbenv/versions/2.3.1/lib/ruby/gems/2.
View soundcloud_controller.rb
class SoundcloudController < ApplicationController
def connect
client = Soundcloud.new(:client_id => 'ID',
:client_secret => 'Secret',
:redirect_uri => "http://localhost:3000/login/soundcloud/callback")
redirect_to client.authorize_url(:scope => 'non-expiring')
end
@parthdesai93
parthdesai93 / aws_es_connector.js
Last active Oct 26, 2020
http-aws-es compatible with new Elasticsearch client.
View aws_es_connector.js
/* requires AWS creds to be updated.
* if they aren't, update using AWS.config.update() method before instatiing the client.
*
* import this module where you instantiate the client, and simply pass this module as the connection class.
*
* eg:
* const client = new Client({
* node,
* Connection: AwsConnector
* });
You can’t perform that action at this time.