Skip to content

Instantly share code, notes, and snippets.

Ryan Rauh rauhryan

Block or report user

Report or block rauhryan

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
@samselikoff
samselikoff / future-proof.md
Last active Dec 11, 2019
Future-proofing your Ember 1.x code
View future-proof.md

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
View .pryrc
# Using these pry gems
# gem "pry"
# gem "pry-rails"
# gem "pry-byebug"
# gem "pry-stack_explorer"
# gem "pry-doc"
# gem "pry-state"
# gem "pry-toys"
# gem "pry-rescue"
@untergeek
untergeek / kibana.json
Last active Mar 27, 2019
Simple Kibana dashboard for collectd stats
View kibana.json
{
"title": "Collectd: Blackbox",
"services": {
"query": {
"list": {
"0": {
"query": "plugin:\"load\"",
"alias": "Load",
"color": "#7EB26D",
"id": 0,
@branneman
branneman / better-nodejs-require-paths.md
Last active Jan 21, 2020
Better local require() paths for Node.js
View better-nodejs-require-paths.md

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

View loading-error-substates-guide.md

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

View angular.js
// 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) {
@dahlke
dahlke / jquery-conference-austin.md
Last active May 19, 2016
Some notes on all of the talks given at jQuery Conference Austin. (September 10th & 11th 2013, [http://events.jquery.org/2013/austin/])
View jquery-conference-austin.md

jQuery Conference Austin

10 Sept 2013

The State of jQuery - Dave Methvin

View alert.hbs
<div id="alert">
<div id="flash">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Warning!</strong>
<span></span>
</div>
</div>
@passcod
passcod / extend.coffee
Last active Dec 21, 2015
This is really normal prototypal inheritance, and the #extend and #create methods are just there for convenience, not to hide away the magic.
View extend.coffee
Namespace.extend = (src, obj = {}) ->
if typeof obj.init is 'function'
newObj = obj.init
delete obj.init
else
newObj = ->
newObj.prototype = Object.create src.prototype
newObj.prototype.constructor = newObj
for prop of obj
@cowboyd
cowboyd / gist:6299096
Created Aug 21, 2013
I did not know that.
View gist:6299096
[1] pry(main)> Class.new.respond_to?(:define_method)
=> false
[2] pry(main)> Module.new.respond_to?(:define_method)
=> false
[3] pry(main)> Class.new.send(:define_method, :yup) {}
=> #<Proc:0x00000100a08cb8@(pry):3 (lambda)>
[4] pry(main)> Module.new.send(:define_method, :yup) {}
=> #<Proc:0x00000100d8f468@(pry):4 (lambda)>
You can’t perform that action at this time.