Skip to content

Instantly share code, notes, and snippets.

Dylan Jhaveri dylanjha

  • Mux
  • San Francisco
Block or report user

Report or block dylanjha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dylanjha / script.js
Created Jul 16, 2013
a little javascript flash message. see demo at:
View script.js
<div id='nav'>
<ul class='nav-list'>
<li class='nav-item'><a href="javascript://">Home</a></li>
<li class='nav-item'><a href="javascript://">There</a></li>
<div id='flash-container' class='flash-container'>
<div id='content'>
Here is some content.
xaviershay / repro.rb
Created Jul 5, 2013
Unexpected behaviour defining Ruby classes anonymously.
View repro.rb
repro.rb:16:in `block in <main>': uninitialized constant B (NameError)
from repro.rb:13:in `initialize'
from repro.rb:13:in `new'
from repro.rb:13:in `<main>'
dylanjha / css3-mixins.css.scss
Last active Dec 19, 2015
A bunch of handy mixins for SASS. Who ever thought vendor prefixes were a good idea, anyway?
View css3-mixins.css.scss
// Border Radius
@mixin round($radius: 4px) {
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
// Box Shadow
@mixin shadow($shadow1: 0 0 4px #0A0A0A, $shadow2:false, $shadow3:false, $shadow4:false, $shadow5:false) {
$params: $shadow1;
@if $shadow2
dylanjha / super.rb
Last active Dec 17, 2015
verifying how Ruby inheritance works
View super.rb
# 2.0.0dev :175 > @three =
# => #<Three:0x007fad66054540>
# 2.0.0dev :176 > @three.my_method
# im in class three
# im in the module
# im in class two
# im in class one
# @three.my_method_2
# <Three:0x108ca55e0>
View font-resize.js
// an element with class 'font_resize' with css properties:
// * max-height
// * max-width
// * font-size
// the element has children span elements, the font size inside these spans will re resized.
$.fn.fontResize = function(options){
var spans = $('span:visible', this);
var heightMax = parseInt($(this).css('max-height'), 10),
View gist:5223561
#!/usr/bin/env ruby
require 'em-proxy'
TARGET = ARGV[0] ? ARGV[0].to_sym : :mysql
puts "Starting proxy on port 4000."
puts "Passing requests port 4100 (mysql) and port 4200 (postgres). Responses are returned from #{TARGET}."
Proxy.start(:host => "", :port => 4000, :debug => true) do |conn|
@start =
@data ="")
bkeepers /
Last active Feb 12, 2019
Keep two HTML5 video elements in sync.
videos = document.getElementsByTagName('video')
new VideoSync(videos[0], videos[1])
View jquery-ui-tabs-1.9.2-patch.js
//this is to patch a bug with the jquery.ui.tabs API
// it has to do with the <base href> tag in <head> and jquery.ui.tabs
// being smart about figuring out weather to AJAX a tab or not
;(function() {
var tabsInitialised = false;
var _tabs = $.fn.tabs;
var updateBaseHrefs = function() {
kenkeiter / text_extents.js
Created Jul 12, 2012
Resize text to fit a min/max.
View text_extents.js
$.fn.textExtents = function(options){
var spans = $('span:visible', this);
var heightMax = parseInt($(this).css('max-height'));
var widthMax = parseInt($(this).css('max-width'));
var fontSize = parseInt($(this).css('font-size')); /* max font size */
var textHeight = 0;
var textWidth = 0;
kconragan /
Last active Oct 9, 2019
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
You can’t perform that action at this time.