Skip to content

Instantly share code, notes, and snippets.

View benkoshy's full-sized avatar

Ben Koshy benkoshy

View GitHub Profile

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@benkoshy
benkoshy / Assumptions to consider when creating an algorithm.md
Last active February 13, 2017 22:25
Assumptions to consider when formulating algorithms

Assumptions to consider when formulating algorithms

  1. What are the range of inputs and outputs?

    (a) Characteristics of input/output values? (i.e. duplicated records, redundant records, uncleaned data etc)

    (b) data structure of inputs/outputs: can you think of a structure that will make everyone's life easier.

  2. What are the costs of inaccuracy? Can they be latter fixed?

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@benkoshy
benkoshy / gist:487b2ed0599975f860dcff43d9efa77f
Created March 22, 2017 05:05
Create wall Example updated to 2017 - (Untested code WARNING)
namespace CreateRevitPanel
{
using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
@benkoshy
benkoshy / PieEstimate.md
Created March 26, 2017 01:24
PiEstimate
namespace BKTest
{    
    public class Pie
    {
        /// <summary>
        /// Estimates pi based on the number of fractions we desire it to estimate by.
        /// The way I view it: you basically have 4 * (fractions + fraction etc.)
        /// So I've basically abstracted the fraction component.
        /// </summary>
@benkoshy
benkoshy / PieEstimate-Attempt#2.md
Last active March 29, 2017 00:37
PieEstimate-Attempt#2

Here is the code:

namespace BKTest
{
    public class Pie
    {
        /// <summary>
        /// Estimates pi based on the number of fractions we desire it to estimate by.
        /// The way I view it: you basically have 4 * (element0 + element1 + element2 etc.)
require_relative 'data_values' #the strings of facts for each city are stored in an array here
 #any string in the hash is just a 'fill-in' for cities without facts yet.
city_hash = {  
:Portland => [FactPort0 , FactPort1 , FactPort2, FactPort3 , FactPort4],
:SanFrancisco => [FactSF0 , FactSF1 , FactSF2, FactSF3 , FactSF4] ,
:SantaFe => [FactSAFE0 , FactSAFE1 , FactSAFE2, FactSAFE3 , FactSAFE4]   ,
:Tokyo => [FactTKY0 , FactTKY1 , FactTKY2, FactTKY3 , FactTKY4] ,
:Seattle => [FactSEA0 , FactSEA1 , FactSEA2, FactSEA3 , FactSEA4] ,
:Vancouver => [FactVAN0 , FactVAN1 , FactVAN2, FactVAN3 , FactVAN4] ,
@benkoshy
benkoshy / quiz-kata-code-review-oop-myAnswer.md
Last active April 4, 2017 22:33
OOP attempt at redoing a code attempt by someone which is basically a quiz which returns facts about a certain selected city
class Quiz
  attr_reader :cities

  def initialize
    @cities = get_cities   
    introduction
  end

  def get_cities
@benkoshy
benkoshy / Point3dComparer.md
Last active July 3, 2019 08:43
A Point3d Comparer - it allows us to compare lists which are populated by points

The Point Comparer

        // Attributed to Gilles. But I made some very minor modifications.
        // WARNING: Implement the EqualityComparer<T> abstract class, rather than the
        // IEqualityComparer<T> interface. This is because the MS documentation recommends
        // that you do so.
@benkoshy
benkoshy / sender-receiver-message.md
Last active April 9, 2017 23:54
Sender, Receiver, Message
    class Program
    {
        static void Main(string[] args)
        {

            Boss grumpy = new Boss();
            FuriousFreddie f = new FuriousFreddie();
     
 // here grump is the receiver