Skip to content

Instantly share code, notes, and snippets.

View BiggerNoise's full-sized avatar

Andy Davis BiggerNoise

View GitHub Profile
@BiggerNoise
BiggerNoise / SelectList.groovy
Created July 3, 2019 16:17
This will allow DataGrip results to be copied to the clipboard so they can be easily used in a select query
SEP = ", "
QUOTE = "\'"
NEWLINE = System.getProperty("line.separator")
KEYWORDS_LOWERCASE = com.intellij.database.util.DbSqlUtil.areKeywordsLowerCase(PROJECT)
def record(column, dataRow) {
def value = dataRow.value(column)
if( value == null)
return
@BiggerNoise
BiggerNoise / Slack-Paste.groovy
Created April 26, 2019 16:18
This will allow DataGrip results to be copied to the clipboard in a slack friendly markdown format.
SLACK_CODE = "```"
SEP = "|"
NEWLINE = System.getProperty("line.separator")
def scan(ROWS, COLUMNS) {
result = []
result.add(COLUMNS.collect { col -> col.name() })
ROWS.each { row -> result.add(COLUMNS.collect { col -> row.value(col).toString() }) }
@BiggerNoise
BiggerNoise / Dockerfile
Created February 8, 2016 17:41
Simple Dockerfile and bash scripts for playing around with signals & docker
FROM debian:jessie
MAINTAINER Koan Health <development@koanhealth.com>
ADD ./run.sh /usr/bin/
CMD ["run.sh"]
@BiggerNoise
BiggerNoise / task_poller.rb
Created September 4, 2013 20:04
Proposed way to rework the execute() method in ActivityTaskPoller so that it does not mark an activity as failed when only the completion notification fails
def execute(task)
activity_type = task.activity_type
begin
context = ActivityExecutionContext.new(@service, @domain, task)
activity_implementation = @activity_definition_map[activity_type]
raise "This activity worker was told to work on activity type #{activity_type.name}, but this activity worker only knows how to work on #{@activity_definition_map.keys.map(&:name).join ' '}" unless activity_implementation
output = activity_implementation.execute(task.input, context)
@logger.debug "Responding on task_token #{task.task_token} for task #{task}"
rescue ActivityFailureException => e
respond_activity_task_failed_with_retry(task.task_token, e.message, e.details)
@BiggerNoise
BiggerNoise / document_read_test.rb
Created July 1, 2013 01:15
Trying to demonstrate an issue that I am having when running capybara with a page that has an on document ready callback
require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
puts 'You Lose' unless sess.has_content? 'Here it Is'
@BiggerNoise
BiggerNoise / read_flawed_spreadsheet.rb
Created January 25, 2013 18:38
Shows using the spreadsheet gem to read a file that is flawed. Worksheets and dimensions are correct, but cell data cannot be read. File that causes the issue can be found at: http://dl.dropbox.com/u/83477489/sample.xls
#!/usr/bin/env ruby
wb = Spreadsheet.open('sample.xls')
puts "Opened Spreadsheet, #{wb.sheet_count} sheets encountered"
(0..wb.sheet_count-1).each do |sheet_number|
ws = wb.worksheet(sheet_number)
puts "\tWorksheet #{ws.name} has #{ws.row_count} rows and #{ws.column_count} columns}; and Dimensions: #{ws.dimensions}"
end
@BiggerNoise
BiggerNoise / additional_parameters.js
Created September 2, 2012 04:01
Namespace/Module Use 4
company.master.users = company.master.users.extend(function($, log){
}, $, loggingSystem);
@BiggerNoise
BiggerNoise / user_exposed.js
Created September 2, 2012 04:00
Namespace/Module Use 3
company.master.users = company.master.users.extend(function(){
// use it
var myLocalThing = this.privateThing,
ExposedClass = function(){
};
return {
Exposed:ExposedClass
}
});
@BiggerNoise
BiggerNoise / usermodule.js
Created September 2, 2012 04:00
Namespace/Module Use 2
company.master.users = company.master.createModule( function(){
var RevealedClass, hiddenFunction
RevealedClass = function(){
// stuff
};
hiddenFunction = function(){};
// this is the private area of the module
this.privateThing = 42;
@BiggerNoise
BiggerNoise / ns_module1.js
Created September 2, 2012 03:56
Namespace & Module Use I
company = app.namespace(company);
company.master= app.namespace(company.master)