Skip to content

Instantly share code, notes, and snippets.

@spacemunkay
spacemunkay / gist:5655134
Last active December 17, 2015 18:39
app/assets/javascripts/custome_netzke_helpers.js
Ext.define('Ext.ux.form.field.ColorCombo', {
extend:'Ext.form.FieldContainer',
mixins:{
field:'Ext.form.field.Field'
},
alias: 'widget.xcolorcombo',
//configurables
combineErrors: true,
msgTarget: 'under',
@spacemunkay
spacemunkay / gist:5655147
Created May 27, 2013 04:04
app/components/bosses/javascripts/init_component.js
{
initComponent: function(){
//your init component
},
colorBlock: function(value){
return Ext.String.format('<div style="display:inline-block">{1}</div><div style="background-color:#{0};width:50px;height:10px;display:inline-block;margin:0 5px 0 5px;border:solid;border-color:gray;border-width:1px;"></div>', value, value);
}
}
@spacemunkay
spacemunkay / gist:5655153
Last active December 17, 2015 18:39
app/components/bosses.rb
# def configure(c)
c.columns = [
# Needs to have type :action or else won't work in grid, because... netzke modifies the xtype otherwise
# This means you have to define it again in default_fields_for_forms
{ :name => "color", :text => "Boss Color", :type => :action, :editor => { :xtype => "xcolorcombo"}, :renderer => :color_block}
]
# def default_fields_for_forms
[
{ :name => "color", :xtype => "xcolorcombo"}
@spacemunkay
spacemunkay / custom_netzke_helpers.js
Last active December 28, 2015 06:59
AM PM Meridian Time Picker for ExtJS and Netzke
// Derived from:
// https://github.com/netzke/netzke-basepack/blob/83414d241de37eae9df7fc2af36951371ecb4c77/javascripts/xdatetime.js
//Override default netzke time entry field
Ext.define('Ext.ux.form.field.DateTime', {
extend:'Ext.form.FieldContainer',
mixins:{
field:'Ext.form.field.Field'
},
alias: 'widget.xdatetime',
@spacemunkay
spacemunkay / invite_all.js
Created July 8, 2014 22:31
Invite all to Facebook events
// https://www.facebook.com/pages/Code-to-invite-all-friends-to-a-eventpage/169258573166847
elms=document.getElementsByName("checkableitems[]");for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()};
@spacemunkay
spacemunkay / accessor_union.rb
Last active August 29, 2015 14:06
Accessor confusion with Array Union
class MyClass
attr_accessor :values, :uniq_values
def initialize(value)
self.uniq_values = ['default_value']
self.values = ['default_value']
copy_value(value)
add_value(value)
end
@spacemunkay
spacemunkay / keybase.md
Created June 30, 2017 15:25
keybase.md

Keybase proof

I hereby claim:

  • I am spacemunkay on github.
  • I am jasondenney (https://keybase.io/jasondenney) on keybase.
  • I have a public key ASDyYfIbNZe8N3B5KbFtg__1-VdZFSjrq4DEMOlC6NIYwAo

To claim this, I am signing this object: