Skip to content

Instantly share code, notes, and snippets.

View parthdesai93's full-sized avatar

Parth Desai parthdesai93

  • scorebet
  • Canada
View GitHub Profile
@parthdesai93
parthdesai93 / crowdlinker-dog.js
Created March 29, 2016 19:17
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.
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 March 29, 2016 19:21
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.
div#header > div.navbar{
width: 100px;
padding-left: 10px;
visibility: visible;
position: fixed;
top: 30px;
}
@parthdesai93
parthdesai93 / oauth_error.log
Created August 8, 2016 19:19
rails soundcloud backtrace
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.
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 April 8, 2021 06:18
http-aws-es compatible with new Elasticsearch client.
/* 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
* });