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 / test.html.erb
Created Mar 22, 2015
Rake task to load erb
View test.html.erb
<%# Put this file in app/views/test.html.erb %>
<h1>Here is some html</h2>
<%= name %>
View view.html
.when('/users/:tab', {
templateUrl: 'views/users/index.html',
controller: 'UsersController'
// UsersController
.controller('HomeController', function ($scope, $http, $routeParams) {
$ = $
dylanjha / 0. sprockets_depend_on_config.rb
Last active Jan 25, 2018
Adds Sprockets Directive `depend_on_config`. I'm using this to load .yml locale translations on the server into the client in json
View 0. sprockets_depend_on_config.rb
//= depend_on_config 'locales/es.yml'
dylanjha / 1. application.html.erb
Last active Jan 31, 2016
Set a `currentUser` in Ember world that all controllers ( and all views ) can access. I'm using Ember 1.5.0 and Ember Data 1.0.0-beta.6
View 1. application.html.erb
<!DOCTYPE html>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag "templates/all" %>
<%= csrf_meta_tags %>
dylanjha / js-testing.js
Last active Jan 1, 2016
Am I doing this wrong? My goal here is to set up a constructor that I can test. The first bit is how I would normally create this new constructor MyObject... the second bit shows how I have to change it in order to test some of the internal functions. See my first comment below.
View js-testing.js
//this constructor, MyObject is supposed to only have 1 publically exposed method: .getResults()
;(function ( $, window, document, undefined ) {
window.MyObject = function(params){
var error = params.error;
function _shouldFireRequest = function(){
//some logic
return boolean
dylanjha / sope.js
Created Aug 1, 2013
Javascript Scope. Most languages with C syntax have block scope. All variables defined in a block ( curly braces ) are not visible from outside of the block. Unfortunately, JS does not have block scope, even though its block syntax suggests that it does. JS has function scope. That means that the parameters and variables defined in a function ar…
View sope.js
var foo = function(){
var a = 3
,b = 5;
var bar = function(){
var b = 7
,c = 11;
//Right here: a == 3, b == 7 and c == 11
dylanjha / apply.js
Created Aug 1, 2013
The Apply Invocation Pattern
View apply.js
myFn = function(msg){
return msg + this.status;
o = { status: "killing it" }
myFn.apply(o, ["Your status is: "])
//>> "Your status is: killing it"
View .gitconfig
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
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.
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
You can’t perform that action at this time.