Skip to content

Instantly share code, notes, and snippets.

View doxavore's full-sized avatar

Doug Mayer doxavore

View GitHub Profile
_getObjectAttr: function () {
var object = {},
formValues = this.get("value");
for (name in formValues) {
if (formValues.hasOwnProperty(name)) {
var nameParts = name.replace(/\]/g, '').split('['),
building = object;
dojo.forEach(nameParts, function (part, idx) {
(function () {
// Static list across all Persons?
var pets = [ ];
dojo.declare("Person", null, {
}
}());
fromString: function (dateString) {
if (!dateString) { return new Date(); }
// IE/Safari expects "2011/05/03 09:03:21-0500"
if (dojo.isIE || dojo.isSafari) {
// Replace hyphens with forward slashes (2011-05-03 => 2011/05/03)
dateString = dateString.replace(/^(\d{4})-(\d{2})-(\d{2})/, "$1/$2/$3");
// Replace T prefixing time with a space (T09:03:21 => " 09:03:21")
dateString = dateString.replace(/T(\d+:\d+:\d+)/, " $1");
// Remove colon in timezone (-05:00 => -0500)
require 'java'
require 'jodconverter-cli-2.2.1.jar'
def convert(file_in,file_out)
inputFile = java.io.File.new(file_in)
outputFile = java.io.File.new(file_out)
# connect to an OpenOffice.org instance running on port 8100
connection = com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection.new(8100)
connection.connect()
require 'java'
require 'jodconverter-cli-2.2.1.jar'
def convert(file_in,file_out)
inputFile = java.io.File.new(file_in)
outputFile = java.io.File.new(file_out)
# connect to an OpenOffice.org instance running on port 8100
connection = com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection.new(8100)
connection.connect()
@doxavore
doxavore / tmux.conf
Created November 13, 2011 15:47 — forked from bryanl/tmux.conf
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
guard 'rails', :port => 3000, :server => :thin, :debugger => true do
watch('Gemfile.lock')
watch(%r{^(config|lib)/.*})
# When caching classes, also restart when app is changed
cache_line = `cat config/environments/development.rb | grep "config\.cache_classes ="`
if cache_line =~ /=\s*(true|false)/ && $1 == 'true'
watch(%r{^app/.*})
end
end
@doxavore
doxavore / gist:1676687
Created January 25, 2012 15:07 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1676687)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
resize: ->
elem = @$()
usableHeight = elem.height()
elem.children(':not(.si-fill-container)').each (idx, childEl) ->
usableHeight -= $(childEl).outerHeight()
@$('.si-fill-container').css('height', "#{usableHeight}px")
@doxavore
doxavore / gist:1761475
Created February 7, 2012 19:44
Don't let Ember.js override setter
Person = Ember.Object.extend({
pets: (function (key, val) {
if (arguments.length > 1) {
// set value
}
else {
// return value
}
}).property('_pets')
});