Skip to content

Instantly share code, notes, and snippets.

View hrishimittal's full-sized avatar

Hrishi Mittal hrishimittal

View GitHub Profile
@hrishimittal
hrishimittal / Equity.md
Last active March 1, 2024 21:13 — forked from isaacsanders/Equity.md
Joel Spolsky's Totally Fair Method to Divide Up The Ownership of Any Startup

This is a post by Joel Spolsky, originally posted on answers.onstartups.com in response to a question. You can find a copy here.

Forming a new software startup, how do I allocate ownership fairly?

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea

def solve(url)
require 'net/http'
require 'json'
uri = URI(url)
response = JSON.parse(Net::HTTP.get(uri))
puts response
solve(response["follow"].gsub('challenge', 'challenge.json')) if response["message"] == "This is not the end"
end
solve("https://www.letsrevolutionizetesting.com/challenge.json")
div.css-1dbjc4n.r-1dgieki.r-1efd50x.r-5kkj8d.r-13awgt0.r-18u37iz.r-tzz3ar.r-s1qlax.r-1yzf0co {
display: none;
}
div.css-1dbjc4n.r-13awgt0.r-18u37iz.r-1w6e6rj {
display: none;
}
span.css-901oao.css-16my406.r-poiln3.r-n6v787.r-1cwl3u0.r-1k6nrdp.r-1e081e0.r-qvutc0 {
display: none;
@hrishimittal
hrishimittal / add_to_mailchimp_group.rb
Created April 6, 2021 17:51
Add email to Mailchimp group via API
def add_to_mailchimp_group(email)
gibbon = Gibbon::Request.new
gibbon.lists('some_list_id')
.members(Digest::MD5.hexdigest(email.downcase).downcase)
.upsert(body: {
email_address: email,
status: "subscribed",
interests: {'some_group_id' => true},
merge_fields: {"MERGE1" => 'merge_field_value'}
})
@hrishimittal
hrishimittal / macbook_setup.md
Last active September 25, 2020 09:53
Setting up a new MacBook for Ruby on Rails web development
  1. Install Google Chrome
  2. Install Karabiner-Elements and map fn key to ctrl - https://github.com/tekezo/Karabiner-Elements
  3. Install Homebrew - http://brew.sh/
  4. Install GnuPG - brew install gnupg2
  5. Generate SSH key - ssh-keygen -t rsa -b 4096 -C "hrishimittal@gmail.com"
  6. Install rvm - http://rvm.io/
  7. Install ruby - rvm install 2.4.0 (or whatever the latest version is)
  8. Install Postgres.app - https://postgresapp.com/ Add psql to path - /Applications/Postgres.app/Contents/Versions/latest/bin/psql
  9. Git - brew install git
@hrishimittal
hrishimittal / rnmap.js
Created October 13, 2018 11:57
react-native-webview-leaflet on iOS
import React from 'react';
import { StyleSheet } from 'react-native';
import WebViewLeaflet from 'react-native-webview-leaflet';
onLoad = (event) => {
const mapLayers = [
{
name: 'OpenStreetMap',
checked: 'true',
type: 'TileLayer',
@hrishimittal
hrishimittal / gist:4754b7d5a5c5ad68c673ba5562573a73
Created July 23, 2018 11:22 — forked from jacobvosmaer/gist:3187346
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

#Put this in application_controller.rb to trace all redirects
def redirect_to(options = {}, response_status = {})
puts("Redirected by #{caller(1).first rescue "unknown"}")
super(options, response_status)
end
#Put this in application_controller.rb to trace all redirects

[title] How to use React with a Rails 5 API app - A hands-on tutorial

[intro]

  • React and Rails make a great combination
  • In this hands-on tutorial, I'll show you how to build a complete React app that works with a Rails 5 API
  • You need to be comfortable with Rails but don't need to be a JavaScript or React expert
  • What we're going to build - an Idea board!
  • Outline of the steps we'll take to build this app
@hrishimittal
hrishimittal / FormErrors.js
Last active March 12, 2017 17:53
react form validation
import React from 'react';
export const FormErrors = ({formErrors}) =>
<div className='formErrors'>
{Object.keys(formErrors).map((fieldName, i) => {
if(formErrors[fieldName].length > 0){
return (
<p key={i}>{fieldName} {formErrors[fieldName]}</p>
)
} else {