Skip to content

Instantly share code, notes, and snippets.

View jkamenik's full-sized avatar

John Kamenik jkamenik

View GitHub Profile
@jkamenik
jkamenik / Controller.js
Created August 1, 2011 13:04
Ext3 Views and Controllers - Controller.js
Ext.ComponentMgr.singletons = {};
Ext.ComponentMgr.create = function(config, defaultType){
if(config.render){ return config; }
var item = new Ext.ComponentMgr.types[config.xtype || defaultType](config);
if(item.xtype){
Ext.ComponentMgr.singletons[item.xtype] = item;
}
return item;
};
@jkamenik
jkamenik / content.js
Created August 1, 2011 13:23
Ext3 View and Controllers - Content.js
App.view.layout.Content = Ext.extend(Ext.Panel,{
layout: 'card',
layoutConfig: {deferredRender: true},
items: [{html: 'first card'}],
activeItem: 0,
defaults: {
border: false
},
showCard: function(card){
@jkamenik
jkamenik / ContentController.js
Created August 1, 2011 13:25
Ext3 View and Controller - ContentController.js
App.controller.NavController = Ext.extend(App.controller.Controller,{
init: function(){
this.control({
// Tree panel that changes the content when nodes are clicked
'App.view.layout.Nav': {
click: this.navClick,
scope: this
}
});
},
@jkamenik
jkamenik / apache-after.feature
Created August 17, 2011 12:38
Cucumber should_receive
Scenario: Apache restart again
Given Apache is running
And Apache can restart
When I go to the apache page
And I click restart
Then Apache should restart
@jkamenik
jkamenik / index-body.html
Created August 17, 2011 12:47
JS Unit Testing using YUI
<body>
<input onclick="javascript:runAllTests()" type="button" value="Run Tests" />
<script>
new YAHOO.tool.TestLogger();
function runAllTests(){
YAHOO.tool.TestRunner.run();
}
</script>
@jkamenik
jkamenik / proxy.rb
Created August 17, 2011 13:01
Sinatra Proxy
res = Net::HTTP.start(<server>,<port>) do |http|
http.get <url>
end
res.body
@jkamenik
jkamenik / ability.rb
Created October 26, 2011 13:45
Cancan
def super_user
can :see_user, Ticket
end
@jkamenik
jkamenik / include.rb
Created November 21, 2011 21:43
Ruby module instance and class methods
module Foo
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def bar
end
end
@jkamenik
jkamenik / install_firefox.sh
Created November 30, 2011 14:05
CI server using Firefox
$ sudo apt-get install firefox
class RegistrationsController < Devise::RegistrationsController
layout false
end