Skip to content

Instantly share code, notes, and snippets.

View 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:

@spacemunkay
spacemunkay / accessor_union.rb
Last active Aug 29, 2015
Accessor confusion with Array Union
View accessor_union.rb
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 / invite_all.js
Created Jul 8, 2014
Invite all to Facebook events
View invite_all.js
// 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 / custom_netzke_helpers.js
Last active Dec 28, 2015
AM PM Meridian Time Picker for ExtJS and Netzke
View custom_netzke_helpers.js
// 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 / gist:5655153
Last active Dec 17, 2015
app/components/bosses.rb
View gist:5655153
# 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 / gist:5655147
Created May 27, 2013
app/components/bosses/javascripts/init_component.js
View gist:5655147
{
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:5655134
Last active Dec 17, 2015
app/assets/javascripts/custome_netzke_helpers.js
View gist:5655134
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',