Skip to content

Instantly share code, notes, and snippets.


Srinivas Rao-Mouw raorao

  • San Francisco, CA
View GitHub Profile
raorao /
Last active March 22, 2023 01:07
PR Comment Emojis

Any top-level comment on pull request ought be tagged with one of four emojis:

  • for a non-blocking comment that asks for clarification. The pull request author must answer the question before the pull request is merged, but does not have to wait for the comment author to re-review before merging.

  • 🎨 for a non-blocking comment that proposes a refactor or cleanup. The pull request author does not have to address the comment for the pull request to merge.

  • ⚠️ for a blocking comment that must be addressed before the pull request can merge. The comment's author should leave a Request Changes review, and is responsible for re-reviewing once the pull request author has addressed the issue.

  • 😻 for a comment that compliments the author for their work.

raorao / ets_cache.ex
Last active August 25, 2022 20:14
Simple ETS based cache with TTL
View ets_cache.ex
defmodule RequestCache do
@moduledoc """
Simple ETS-based cache.
use GenServer
@type t :: %{ttl: integer, invalidators: %{}}
@type cache_key :: any
@type cache_value :: any
raorao /
Last active October 10, 2019 20:16
Applying large changes to co-owned repos


  • a script that can make all necessary changes, with no manual intervention.

Steps for Implementer

  1. check out master, run the script, commit the result
git fetch origin
git checkout master
raorao /
Last active July 5, 2018 18:51
valueOf hackery.
obj = (function() {
  currentValue = 7
  return {
    valueOf: function() { return currentValue = currentValue+2 }

(obj < 10) && (obj > 10) //true
raorao / gen_server_cache.ex
Created May 12, 2017 04:30
Simple Process cache in Elixir.
View gen_server_cache.ex
defmodule RequestCache do
@moduledoc """
Simple GenServer-based cache.
use GenServer
@type t :: %{cache: %{optional(cache_key) => cache_value}, interval: integer}
@typep cache_key :: any
@typep cache_value :: any
View foo.html
td {
border: 1px solid black;
width: 40px;
height: 40px;
View elixir-and-fp-1.rb
# nil
GroceryList.add("a gallon of milk")
# :ok
# "a gallon of milk"
View slowapitesting.php
function slowApiLookup() {
try {
$url = "";
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, $url);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1);
$response = curl_exec($curlSession);
View trackClickAlternative.js
<script src="jquery.js" type=text/javascript></script>
<script type=text/javascript>
$(document).ready(function() {
raorao / closures.js
Last active December 28, 2015 06:09
Here's my attempt at explaining closures in JavaScript.
View closures.js
// As I've been know to yell, JavaScript is a stupid language, and I don’t mean that as an insult.
// For example, where Ruby has 50-ish enumerable methods to iterate over collections,
// JS has, basically, two. But that’s okay! That just means you have to build any complicated
// logical structures yourself in JavaScript, which makes your code more transparent and flexible.
// One important structure you often find yourself building from scratch is private functionality
// in object oriented programming. JavaScript closures are one way to achieve that goal.
var counter = (function() {
var currentCount = 0;
return {