Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
queryParams: ['sort'],
sort: 'id',
xsortedMessages: Ember.computed.sort('model', 'sort'),
@backspace
backspace / mongoid-none.rb
Last active August 29, 2015 14:01
Backports Criteria.none to Mongoid 3
module Mongoid
class Criteria
def none
@none = true and self
end
def empty_and_chainable?
!!@none
end
end
@backspace
backspace / new_tab_current_directory_and_settings.scpt
Created May 19, 2011 05:17
An AppleScript that opens a new tab in the current directory with the current settings
(*
This script opens a new Terminal.app tab in the directory of the current tab with the same settings. You’ll need to, if you haven’t already, enable access for assistive devices as described here: http://www.macosxautomation.com/applescript/uiscripting/index.html
It’s almost all the work of two scripts put together, thank you to them:
Chris Johnsen’s script opens a new tab in the current directory: http://superuser.com/questions/61149/os-x-terminal-app-how-to-start-a-new-tab-in-the-same-directory-as-the-current-ta/61264#61264
Jacob Rus’s “menu_click” lets me create the tab with the same settings, as Terminal’s API doesn’t: http://hints.macworld.com/article.php?story=20060921045743404
If you change the name of a Terminal profile, the AppleScript API returns the old name until you restart the application, so the script won’t work on renamed settings until then. Ugh. Also, the necessity of activating Terminal to execute the menu command brings all the terminal windows to the front.