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 = 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>)


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.
jasdeepsingh / recent_files_spec.rb
Last active Aug 29, 2015
View recent_files_spec.rb
#====== Implement your solution below:
# class RecentFiles
# end
#====== Solution implementation ends
require 'rspec'
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
jasdeepsingh /
Last active Aug 29, 2015
Recent Files Tracker

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?
elsif user.parent?
View angular-routing.js
// in router
angular.module('app-name', [], function($routeProvider, $locationProvider, UserService) {
when('/user/:userName', {
templateUrl: 'userShowPage',
controller: UserController,
resolve: {
//resolve functions here...
loadedUser: UserController.resolve.loadUser

Keybase proof

I hereby claim:

  • I am jasdeepsingh on github.
  • I am 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.