Elliott Kember elliottkember

View spinnerView.coffee
1 2 3 4 5 6 7 8 9 10
App.SpinnerView = Ember.View.extend
shadow: false
color: '#000'
tagName: 'span'
classNameBindings: [':loading-spinner', 'isButton:button', 'centered:centered']
didInsertElement: ->
opts =
lines: 13, # The number of lines to draw
length: 4, # The length of each line
width: 2, # The line thickness
View serializer.coffee
1 2 3 4 5 6 7 8 9 10
App.ApplicationSerializer = DS.ActiveModelSerializer.extend
serialize: (record, options) ->
json = @_super record, options
record.eachAttribute (name, attribute) ->
if attribute.options.readOnly
delete json.name
json
App.Object = Ember.Model.extend
name: DS.attr 'string', readOnly: true
View index.php
1 2 3 4 5 6 7 8 9 10
<?php
 
 
// Script addition written by Elliott Kember (elliott@riothq.com) for copying images from an existing directorys
// Copy over other related images
 
// If we start with myimage.png, then:
// This part is "myimage", which is then enumerated with _X.extension (X can be anything, extension can I guess be anything)
$parts = pathinfo($img);
$primary_image_basename = basename($img);
View check.rb
1 2 3 4 5 6 7 8 9 10
apps = `heroku apps`.split("\n")
apps.each do |app|
next if app.include? "My Apps"
app = app.split(" ")[0]
gems = `heroku addons --app #{app}`.split("\n")
gems.each do |gem|
if gem.include? "memcache:"
puts "#{app} is using #{gem}"
end
end
View post.markdown

Chrome does something interesting when you first run it.

import

The other day, I was using Chrome in development for an Ember.js app. I use Safari for day-to-day browsing, but it has a habit of aggressively caching files when I least expect it, so from time to time I switch to Chrome.

I decided to hit Chrome's "Import bookmarks now" link and see whether I could import my bookmarklets from Safari, so things would be nice and consistent between the two browsers. I didn't expect this:

Chrome asking me to import my content from Safari

View embiggen.js
1
javascript:%20var%20x=%20$(%22.content%22).find(%22a%22).each(function()%7Bvar%20href=$(this).attr(%22href%22);if((!$(this).hasClass(%22drowsapMorphed%22))%20&&%20($(this).next(%22.drowsapMorphed%22).length==0)%20&&%20href%20&&%20(href.indexOf('imgur')%3E=0%20%7C%7C%20href.indexOf('jpeg')%3E=0%20%7C%7C%20href.indexOf('jpg')%3E=0%20%7C%7C%20href.indexOf('png')%3E=0))%7Bvar%20ext%20=(href.indexOf('imgur')%3E=0%20&&%20href.indexOf('jpg')%3C0%20&&%20href.indexOf('png')%3C0)%20?%20'.jpg'%20:'';%20var%20img%20=%20$(%22%3Ca%20class='drowsapMorphed'%20href='%22+href+%22'%20target='blank'%20style='display:block'%3E%3Cimg%20style='display:block;max-width:780px;'%20src='%22+href+%20ext+%22'%20/%3E%3C/a%3E%22);$(this).after(img);%7D%7D);
View AppDelegate.m
1 2 3 4 5 6 7 8 9
//
// ABCAppDelegate.m
// ABC
//
// Created by Elliott Kember on 25/07/2013.
// Copyright (c) 2013 Elliott Kember. All rights reserved.
//
 
#import "ABCAppDelegate.h"
View app.js
1 2 3 4 5 6 7 8 9 10
$(function(){
$('*[data-repeat]').each(function(){
var n = $(this).data('repeat');
var parent = $(this).parent();
self = $(this);
for (var i = 0; i < n; i++) {
self.after(self.clone());
}
})
});
View heroku-CVE-2013-0156.rb
1 2 3 4 5 6 7 8 9 10
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
View volumeup.applescript
1 2 3 4 5 6 7 8
-- volume up 10
set current_volume to output volume of (get volume settings)
 
if current_volume is less than 100 then
set current_volume to current_volume + 10
end if
 
set volume output volume current_volume
Something went wrong with that request. Please try again.