Skip to content

Instantly share code, notes, and snippets.

@yoon
yoon / ipboard_permissions.sh
Created April 8, 2015 20:47
ipboard permissions
# https://www.invisionpower.com/support/guides/_/install-and-getting-started/installing-r18
# before installation
## blue
chmod 0777 blog
## blue with *
chmod -R 0777 cache css_files downloads hooks public/ipc_blocks public/style_css public/style_emoticons public/style_images screenshots
uploads
@yoon
yoon / hide_harvest_approval.js
Created March 25, 2015 22:38
GreaseMonkey / TamperMonkey script to Hide HarvestApp "Submit for Approval" button
// ==UserScript==
// @name Hide HarvestApp "Submit for Approval" button
// @namespace http://tablexi.harvestapp.com/
// @version 0.1
// @description This script hides anything with the .approval-button class
// @author Mark Yoon
// @match https://tablexi.harvestapp.com/*
// @grant GM_addStyle
// ==/UserScript==
@yoon
yoon / record.json-schema.draft-04.json
Last active August 29, 2015 14:11
DRAFT health-data-standards JSON schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"entry": {
"allOf": [
{ "$ref": "#/definitions/thing_with_codes" },
{ "properties": {
"description": { "type": ["string", "null"] },
"specifics": { "type": ["string", "null"] },
"time": { "type": ["integer", "null"] },
@yoon
yoon / survey_section.rb
Created August 27, 2014 17:32
custom surveyor survey section model for disabling translations
module SurveySectionCustomMethods
def translation(locale)
{:title => self.title, :description => self.description}
end
end
class SurveySection < ActiveRecord::Base
include Surveyor::Models::SurveySectionMethods
include SurveySectionCustomMethods
end
@yoon
yoon / survey.rb
Created August 27, 2014 17:31
custom surveyor survey model for disabling translations
module SurveyCustomMethods
def translation(locale_symbol)
{:title => self.title, :description => self.description}
end
end
class Survey < ActiveRecord::Base
include Surveyor::Models::SurveyMethods
include SurveyCustomMethods
end
@yoon
yoon / gist:8876313
Last active September 28, 2023 13:06
zip a folder with rubyzip
require 'rubygems'
require 'zip'
archive_directory_path = ''
archive_zip_path = ''
Zip::File.open( archive_zip_path, Zip::File::CREATE ) do |zip_file|
Dir[ File.join( archive_directory_path, "**", "**" ) ].each do |file|
zip_file.add( file.sub( "#{ archive_directory_path }/", "" ), file )
end
@yoon
yoon / export_view.haml
Created July 1, 2013 15:32
surveyor export view
Questions may have many answers, e.g. "Fun, Kind, Cool". Export one column per answer, or collapse to one column per question.
%h4 Columns - one per:
= radio_button_tag :column, :answer, true
= label_tag :column_answer, "answer"
= radio_button_tag :column, :question
= label_tag :column_question, "question"
An answer has various identifiers set in the form definition. Response count is the number of times an answer is selected.
@yoon
yoon / export_model.rb
Last active December 19, 2015 05:09
surveyor export
def self.export(params)
{:report => "", :name => "blank"} if params[:responses].blank?
# surveys
responses_surveys = Survey.includes({:sections => {:questions => :answers}}).find(params[:responses] || [])
questions = responses_surveys.map(&:sections).flatten.map(&:questions).flatten.reject{|q| q.display_type == "label"}
answers = questions.map(&:answers).flatten
# response sets
from = params[:date_from].blank? ? nil : Date.strptime(params[:date_from], '%m-%d-%Y')