Skip to content

Instantly share code, notes, and snippets.

View daveshah's full-sized avatar
💭
💻

Dave Shah daveshah

💭
💻
View GitHub Profile
@daveshah
daveshah / tracking-happiness.md
Created May 10, 2016 14:37
Just some quick notes/thoughts on tracking happiness :)

##Some quick thoughts on tracking happiness I've done this with a couple of teams. I've used Mercury App and Google Forms.

Some things I've learned from this:

  • Setting expectations is important - we're going to have good and bad days - that's okay. That's human.
  • It's important to PAY ATTENTION and HONESTLY AND OPENLY discuss the reasons we're happy / unhappy. (make sure there's room for notes)
  • It's important to remember balance - making one group happy can easily make another one unhappy. Be mindful of the impact of our actions in a larger context!
  • IMO, as with all metrics, this is one the team should own.
  • This definitely takes discipline. It's easy to forget to track things. Try and set a calendar reminder (or similiar) to take 5 minutes or so and keep this habit.
@daveshah
daveshah / channels_to_slackers.ex
Last active March 11, 2016 01:22
Determines biggest slackers
BiggestSlacker.Slack.channels
|> Enum.take(10)
|> Enum.map(&{&1.id, &1.name})
|> Enum.map(fn({id, name}) -> {name, BiggestSlacker.Slack.channel_history(id)} end)
|> Enum.map(fn({name, hist_map}) -> {name, BiggestSlacker.Stats.users_to_message_counts(hist_map.messages)} end)
|> Enum.map(fn({name,list}) -> {name, Enum.at(list,0)} end)
@daveshah
daveshah / LoadingSpec.groovy
Created January 21, 2016 20:37
(non-working) attempt at DIH into Solr
def "Loading into the solr core"() {
given: "An empty solr core"
def solrServer = new EmbeddedSolrServer(Paths.get("../solr"), "corename")
when: "I load the core"
def params = new ModifiableSolrParams(){{
add("command","full-import")
add("clean","true")
add("commit","true")
@daveshah
daveshah / ios_to_android.rb
Created December 18, 2015 02:38
Ugh, because this is one of those things I've done way too much
require 'fileutils'
class Tuple
attr_accessor :first, :last
def initialize(first,last)
@first = first
@last = last
end
end
@daveshah
daveshah / AwesomeSauce.java
Created November 24, 2015 15:56
Scoping Java objects - using package protected scope to ensure abstractions don't bleed out
package com.lolz;
public class AwesomeSauce {
{
// Note that the interface is package protected so trying to access these outside the
// package is no-bueno!
Foo.Bar bar = new Foo.Bar();
Foo.Baz baz = new Foo.Baz();
@daveshah
daveshah / setjdk.sh
Created September 28, 2015 16:06
Pop this in your .zshrc or .bashrc
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
@daveshah
daveshah / hello.scala
Created August 24, 2015 14:04
Making a standalone Scala script (that is, no explicit invocation of Scala on the command line)
#!/usr/local/bin/scala
::#!
@echo off
scala %0 %*
goto :eof
::!#
println("Hello Dave")
@daveshah
daveshah / hansel_and_gretel_programming.md
Last active August 29, 2015 14:26
Hansel & Gretel Programming

A few years back I was pairing with a developer who passed on a really good habit of jotting down thoughts as we paired. We'd always have a stack of post-it notes by our side and as we'd navigate through the code base focused on our current task and test, we'd take note of things that needed to be cleaned.

The interesting thing I noticed about this - sometimes these notes would give us the breadcrumb trail we needed to get right back on track.

Every developer worth their salt should try and live by the boyscout rule. In a big forest of a codebase, it's easy to start tidying up far from the original spot we initially want to start cleaning.

Before you know it, you're in some strange part of the codebase you've never been before and you may ask yourself... how did I get here.

The post-its and scratch pads always kept us from getting lost. They always gave us a way back. We'd jot down o

case class Person(id: Int,firstName: String, lastName: String)
object PersonRepository {
private val people = Map(
1 -> Person(1,"Shah","Dave"),
2 -> Person(2,"Barington","Foo")
)
@daveshah
daveshah / show_hidden_files_in_finder.sh
Created July 10, 2015 18:41
Set up Finder to show hidden files (Need to relaunch finder)
#!/bin/bash
defaults write com.apple.finder AppleShowAllFiles YES