Skip to content

Instantly share code, notes, and snippets.

View joshnesbitt's full-sized avatar

Josh Nesbitt joshnesbitt

View GitHub Profile
@lmarlow
lmarlow / date_formats.rake
Created July 22, 2008 22:53
Show available format strings for Date, DateTime, and Time objects in Rails
desc "Show the date/time format strings defined and example output"
task :date_formats => :environment do
now = Time.now
[:to_date, :to_datetime, :to_time].each do |conv_meth|
obj = now.send(conv_meth)
puts obj.class.name
puts "=" * obj.class.name.length
name_and_fmts = obj.class::DATE_FORMATS.map { |k, v| [k, %Q('#{String === v ? v : '&proc'}')] }
max_name_size = name_and_fmts.map { |k, _| k.to_s.length }.max + 2
max_fmt_size = name_and_fmts.map { |_, v| v.length }.max + 1
alias subo='sudo'
alias bungle='bundle'
alias lcok='lock'
alias touch='say "cant touch this, da, da, da, da, duh, der, der, da"; touch'
@pixelhandler
pixelhandler / Ember-Component-Custom-Select-Box.md
Last active December 21, 2015 14:39
Ember.js component for a custom select box which can have a custom visual design and yet keep all standard browser behavior for selecting options. This `faux-select` is an Ember.Component which follows the intention of W3C web component draft for a "custom element"

Ember Components Example

  • With the select element using an opacity of zero (0), the element can have a custom background, and when clicking on the element the hidden select box still behaves normally (browser's default behavior)
  • The element with the class .faux-select-selected needs javascript functionality which updates the content binding to the value that is selected using the invisble select box (on change).

Steps to build a custom "faux" select box

(clone the emberjs/starter-kit to get started, see the components branch on this clone of starter kit...https://github.com/Ember-SC/starter-kit/commits/components)

  1. Start with removing the default index template/model from the emberjs/starter-kit
@JordanAdams
JordanAdams / readme.md
Created September 26, 2017 12:40
My personal workstation setup

Guide to loading/error events and substates

In addition to the techniques described in the Asynchronous Routing Guide, the Ember Router provides powerful yet overridable conventions for customizing asynchronous transitions between routes by making use of error and loading substates.

loading substates

@machty
machty / router-js-refactor-architecture.md
Last active July 31, 2019 18:39
Overview of the architecture and approach to the router.js refactor

router.js Architecture

Let this serve as a guide for anyone who'd like to dig into router.js's internals, understand what's going on, and hopefully contribute!

Scope of router.js (et al)

router.js is most popularly known as the routing microlib used by the Ember.js Router, though other folk have been known to use it beyond Ember, including some Angular folk who weren't satisfied with

@ryanflorence
ryanflorence / angular.js
Last active October 30, 2019 01:42
Comparing an avatar implementation with angular and ember. http://www.angularails.com/articles/creating_simple_directive_in_angular
// Because people can't seem to find the gist description, here is the source
// of this code, a post found in last weeks JS Weekly, it is not my code
// http://www.angularails.com/articles/creating_simple_directive_in_angular
angular.module('ui-multi-gravatar', [])
.directive('multiAvatar', ['md5', function (md5) {
return {
restrict: 'E',
link:function(scope, element, attrs) {
@JamieMason
JamieMason / gist:7357169
Last active March 15, 2020 11:10
List all remote branches, most recent first
for branch in `git branch -r | grep -v HEAD`; do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@jasoncodes
jasoncodes / gist:1223731
Created September 17, 2011 07:45
Installing Ruby 1.9.3 with rbenv on OS X
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p286
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
@JamieMason
JamieMason / GET_GITHUB_TABLE_OF_CONTENTS.md
Last active April 2, 2020 13:27
Quick way to generate a table of contents from a GitHub README

Quick way to generate a table of contents from a GitHub README

Visit the README.md on GitHub.

Paste this into the console in Google Chrome.

[].map
  .call(document.querySelectorAll('.anchor'), el => 
 `* [${el.parentNode.innerText}](${el.getAttribute('href')})`