Skip to content

Instantly share code, notes, and snippets.

View walter's full-sized avatar

Walter McGinnis walter

View GitHub Profile
// app/initializers/options
import Ember from 'ember';
import config from '../config/environment';
// copied and modified from http://ember.zone/handling-environment-data-with-ember-js/
export default {
name: 'options',
initialize: function() {
var OptionsReader = function OptionsReader() {
@walter
walter / proof-of-concept-stuff.md
Last active March 23, 2018 16:18
Example third party widget stuff with Ember.js and ember-cli

Page calling third party widget:

<html>
  <head>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
  </head>
  <body>
    <script class="at-widget-loader" src="proof/widget.js" type="text/javascript" async></script>
import Ember from 'ember'
import { test, moduleFor } from 'ember-qunit';
import startApp from '../../helpers/start-app';
var App;
moduleFor('helper:cdn-avatar-from', 'Helper: cdn-avatar-from', {
setup: function() {
App = startApp();
},
import Ember from 'ember';
export default Ember.Handlebars.makeBoundHelper(function(imageUrl) {
var escaped = encodeURIComponent(imageUrl);
var fullUrl = 'http://d2xfsikitl0nz3.cloudfront.net/' + escaped + '/60/60';
return new Ember.Handlebars.SafeString('<img src="' + fullUrl + '" width="60" height="60" alt="" />');
});
import Ember from 'ember';
import { test, moduleFor } from 'ember-qunit';
@walter
walter / gist:f814b26a8a3bcc6466e5
Created August 20, 2014 01:54
Ember address lookup snippet
// in app/controllers/application.js
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['address'],
address: null
});
// in app/controllers/index.js
import Ember from 'ember';
@walter
walter / keybase.md
Created March 10, 2014 00:18
Keybase verification

Keybase proof

I hereby claim:

  • I am walter on github.
  • I am walter (https://keybase.io/walter) on keybase.
  • I have a public key whose fingerprint is D03E 8FA3 2C08 C33A 8552 F329 A1C2 C88C D59A 0392

To claim this, I am signing this object:

> dump = redis.get("107.77.64.119")
dump = redis.get("107.77.64.119")
WARNING: terminal is not fully functional
- (press RETURN)
=> "\u0004\bo: Geocoder::Result::Freegeoip\a:\n@data{\u0010I\"\aip\u0006:\u0006E(END) q
[18] pry(main)>
[19] pry(main)> dump.present?
dump.present?
ArgumentError: invalid byte sequence in UTF-8
from /u/apps/askthem/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/object/blank.rb:105:in `=~'
(setq-default tab-width 2)
@walter
walter / mybot.conf
Created August 13, 2013 02:13
Upstart script for a Hubot IRC Logger
description "mybot Hubot IRC bot"
# Subscribe to these upstart events
# This will make Hubot start on system boot
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/home/botuser/bots/mybot/'
env HUBOT='runbot.sh'
# for now, only run if we have a clean slate
def self.load_from_apis_for_jurisdiction(abbreviation)
return if self.in(abbreviation).count > 0
api_parse(results_for_jurisdiction(abbreviation)).map do |attributes|
create_from_apis attributes
end
end
def self.create_from_apis(attributes, options = {})