Skip to content

Instantly share code, notes, and snippets.

View anmolagrwl's full-sized avatar

Anmol Agrawal anmolagrwl

View GitHub Profile
@anmolagrwl
anmolagrwl / chat.rb
Last active August 29, 2015 14:09 — forked from rkh/chat.rb
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@anmolagrwl
anmolagrwl / e-commerce.md
Created December 23, 2016 09:17 — forked from hjr3/e-commerce.md
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@anmolagrwl
anmolagrwl / sw-install.js
Created January 29, 2017 21:19
react-pwa-simple
function requestUpdate(sw) {
const shouldUpdate = window.confirm('New version available. Update?');
if (shouldUpdate) {
sw.postMessage({ shouldUpdate: true });
}
}
function checkStateForInstalled(sw) {
sw.addEventListener('statechange', () => {
if (sw.state === 'installed') {
@anmolagrwl
anmolagrwl / tweet_dumper.py
Created February 6, 2017 10:08 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@anmolagrwl
anmolagrwl / gist:0f4b72e0a715ce2b6ef2e51bffa2734b
Created April 14, 2017 10:24 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@anmolagrwl
anmolagrwl / hashes.md
Created April 14, 2017 10:25 — forked from ryansobol/hashes.md
Hashes in Ruby

What's a Hash and why is it important?

A Hash is a collection of key-value pairs. To add, fetch, modify, and delete a value from a Hash, you refer to it with a unique key.

While an Array is indexed by Integers only, a Hash is keyed by any object -- Strings, Integers, etc.

In other programming languages, a Hash might be known as an 'associative array', 'dictionary', or 'HashMap'.

What does a Hash look like?

@anmolagrwl
anmolagrwl / symbols.md
Created April 14, 2017 10:25 — forked from ryansobol/symbols.md
Symbols in Ruby

What's a Symbol and why is it imporant?

In Ruby, a Symbol is the most efficient way, in terms of time and memory, to represent a set of characters.

What does a Symbol look like?

Most commonly, a Symbol is a single word prefixed by a colon:

:hello

Good etiquette in class can help you make the most of your education.

You're an adult; act like one.

If you're in Code Fellows, you're likely at least 18 years old—the age at which you're legally considered an adult. You may not feel like a responsible grown-up yet, but your instructors will assume that you are. So act likewise.

Before you say or do anything in the classroom, ask yourself "How would a mature, well-adjusted, courteous adult act?" I promise that doing so will save you from embarrassment and engender the respect of your classmates and instructors.

Present yourself well.

@anmolagrwl
anmolagrwl / sketch-never-ending.md
Created April 29, 2018 09:56 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com