Skip to content

Instantly share code, notes, and snippets.


Venkat Dinavahi venkatd

View GitHub Profile
venkatd / episode.js
Created Aug 26, 2015
Behavior for jumping to the right place when you click on a time
View episode.js
window.addEventListener("hashchange", forwardAudioForHash, false);
$("#simplecast-audio-player").bind("jPlayer_loadstart", forwardAudioForHash)
$("#simplecast-audio-player").bind("jPlayer_waiting", showLoading)
$("#simplecast-audio-player").bind("jPlayer_playing", hideLoading)
$("#simplecast-audio-player").bind("jPlayer_pause", hideLoading)
$("#simplecast-audio-player").jPlayer("pause", seconds);
View child_remove.js
ref.on("child_removed", function(snapshot) {
if (!resolved) {
var record = store.getById(type,;
if (record !== null) {
}, _handleError);
View ember.style_binding.js
Ember.StyleBinding = Ember.Mixin.create({
concatenatedProperties: ['styleBindings'],
styleBindings: [],
_attachStyleBindings: function() {
var properties = this.get('styleBindings');
// initialize getting properties so the observers start firing
View api_spec.rb
require 'spec_helper'
require 'device_auth/provider/basic'
require 'device_auth/provider/anonymous'
module DeviceAuth
describe API do
describe 'POST /api/v1/register' do
View api_spec.rb
require 'spec_helper'
require 'device_auth/provider/basic'
require 'device_auth/provider/anonymous'
module DeviceAuth
describe API do
describe 'POST /api/v1/auth/register' do
View database.yml
host: localhost
adapter: postgresql
encoding: utf8
database: reissued_development
pool: 5
username: venkat
# Connect on a TCP socket. Omitted by default since the client uses a
View custom-fixture-adapter.js
var CustomFixtureAdapter = DS.FixtureAdapter.extend({
fixturesForType: function(type) {
if (!type.FIXTURES) {
type.FIXTURES = [];
return this._super(type);
createRecord: function() {
return this._super.apply(this, arguments);


Top-down, what-if development

You want to write code from the top down. You start with the highest level code. Those one or two lines of code that will make everything work. Then you write what you would want and write your code that way. Because you are going top down, you're creating objects that don't exist and calling nonexistent methods on them. Doing this lets you define the usage before building the thing. Then you go down a level and repeat this process.

Your code as a product

You want to think of the methods you write, the objects you create, the APIs you design, and everything else as a product. Even if it's just you using it, imagine someone else will use it. This will lead to question such as

  • Does this name make sense? Or is it obvious?
  • How much work is it to use this? Am I creating an unnecessary burden on the user? Could I make this easier to use?
  • How would someone want this to work? Does it work the way they would want it? Can I move this a step further in th

What did I get done yesterday?

What's left for this week and what's my plan for today?

Am I on track to finish everything for this sprint? If not, why?

Anything that you need from others on the team that might have gotten lost?

Action steps

venkatd / jquery.event.special.imageload.js
Created Sep 17, 2011
jQuery image loaded special event
View jquery.event.special.imageload.js
(function ($) {
function img_has_loaded(imgEl) {
var dfd = $.Deferred();
var img = new Image();
img.onload = function() {
if (!dfd.isResolved())
You can’t perform that action at this time.