This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Found at http://www.dribin.org/dave/blog/archives/2006/11/17/hashes_to_ostruct/ | |
require 'ostruct' | |
def hashes2ostruct(object) | |
return case object | |
when Hash | |
object = object.clone | |
object.each do |key, value| | |
object[key] = hashes2ostruct(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
performKeyEquivalent: function(keystring, evt) { | |
if ( keystring == "escape" ) { | |
// Do something funny... | |
return YES; | |
} | |
return sc_super(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SC.Record.mixin({ | |
recordAttributes: function() { | |
var obj = this.prototype; | |
var ret = []; | |
for(var key in obj) { | |
if ( SC.kindOf(obj[key], SC.RecordAttribute) ) | |
ret.push(key); | |
} | |
return ret; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# from: http://hints.macworld.com/article.php?story=2007091814022049 | |
KEY="$HOME/.ssh/id_dsa.pub" | |
if [ ! -f ~/.ssh/id_dsa.pub ];then | |
echo "private key not found at $KEY" | |
echo "* please create it with "ssh-keygen -t dsa" *" | |
echo "* to login to the remote host without a password, don't give the key you create with ssh-keygen a password! *" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo = 10 | |
bar = -> | |
((foo)-> | |
foo = 20 | |
console.log foo # => 20 | |
)() | |
console.log foo # => 10 | |
foo = 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyRoute = Ember.Route.extend({ | |
events: { | |
doSomething: function() { | |
console.log('Yes sir!'); | |
} | |
} | |
}); | |
// If your controller already has a method named `doSomething`, | |
// it'll take precedence over the router's event, as the controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/app.js | |
import Resolver from 'resolver'; | |
// ... | |
import extendLinkView from 'appkit/core_ext/link_view'; | |
extendLinkView(); | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.IndexView = Ember.View.extend({ | |
bindCopyButton: function() { | |
var self = this; | |
var controller = this.get('controller'); | |
var copyButton = this.$('.copy-button'); | |
var clip = new ZeroClipboard(copyButton); | |
clip.on('dataRequested', function (client, args) { | |
client.setText(document.location.href); | |
controller.set('justCopied', true); | |
setTimeout(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Object.extend({ | |
lookupFactory: function(name, container) { | |
container = container || this.container; | |
var fullName = 'component:' + name, | |
templateFullName = 'template:components/' + name, | |
templateRegistered = container && container.has(templateFullName); |
OlderNewer