Skip to content

Instantly share code, notes, and snippets.

jasdeep singh jasdeepsingh

  • Toronto, ON
Block or report user

Report or block jasdeepsingh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View base_controller.rb
class ApplicationController
before_action :authenticate_user
def authenticate_user
response = TokenAuthService.call(token: request.headers['Api-Token'] || params[:api_token])
if response.failure?
render json: {
error: 'Not Authorized',
message: response.error
View component.js
class Component extends React.Component {
component___Mount() { // didMount? willMount?
window.api.asyncCallToBackend() // returns promise
}
render() {
return (<data here that depends on response of async call in one lifecycle methods>)
}
View README.MD

FriendInviter

FriendInviter is a web based application that can be used to, well, wait for it: Invite Friends :P. The goal of the application is to allow a user to invite a maximum of 3 of their friends using their email addresses. Here are some requirements:

  1. Initial user can be either hardcoded or seeded manually in the application from a console etc.
  2. Initial user sends out an email invite to 3 of his/her friends aka Recepients.
  3. Recepients receive email invitations to join FriendInviter.
  4. Upon acceptance of each invite, the person who sent the Invite is credited with points. Each successful invite yields 50 points.
  5. If all 3 invites are successfully accepted, a bonus of 200 points is also awarded.
  6. Invites should be valid for a maximum of 15 minutes.
View yml_to_markdown.md
@jasdeepsingh
jasdeepsingh / recent_files_spec.rb
Last active Aug 29, 2015
recent_files_spec.rb
View recent_files_spec.rb
#====== Implement your solution below:
# class RecentFiles
# end
#====== Solution implementation ends
require 'rspec'
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@jasdeepsingh
jasdeepsingh / recent.md
Last active Aug 29, 2015
Recent Files Tracker
View recent.md

Let's build a Recent File Tracker

  • Implement a Class, name it RecentFiles

  • You can start implementing your class from 2nd line onwards.

  • You can run the test code, which will test your code using the following command: rspec file_name.rb

  • You can replace the file_name.rb with your actual file which you are working with.

  • If you get any errors such as rspec not found etc, please do: sudo gem install rspec

  • The class should be able to handle the following scenarios:

    • Output a list of most recent accessed files.
View notifier_proxy.rb
class Notifier
def notify(user)
if user.student?
send_sms(user.number)
elsif user.parent?
send_email(user.email)
end
end
View angular-routing.js
// in router
angular.module('app-name', [], function($routeProvider, $locationProvider, UserService) {
$routeProvider.
when('/user/:userName', {
templateUrl: 'userShowPage',
controller: UserController,
resolve: {
//resolve functions here...
loadedUser: UserController.resolve.loadUser
View keybase.md

Keybase proof

I hereby claim:

  • I am jasdeepsingh on github.
  • I am jasdeep (https://keybase.io/jasdeep) on keybase.
  • I have a public key whose fingerprint is 6550 3A83 EAC2 9730 5A82 095C CC82 3B63 DB9B 2E7F

To claim this, I am signing this object:

You can’t perform that action at this time.