Skip to content

Instantly share code, notes, and snippets.

View minch's full-sized avatar

Adam Weller minch

View GitHub Profile
responses = []
host = 'https://api.getfeedback.com'
api_key = '[YOUR_API_KEY]'
path = '/surveys/[YOUR_SURVEY_ID]/responses'
def fetch_results_by_page(connection, page, path, per_page = 20)
response = connection.get(path) do |request|
request.params['page'] = page
request.params['per_page'] = per_page
# team_id first_officer_id
91 91
79357 79357
507 507
735 735
995 995
2154 2154
4131 4131
38247 38247
8701 8701
diff --git a/config/initializers/active_record.rb b/config/initializers/active_record.rb
index 2f966a7..51a5cc7 100644
--- a/config/initializers/active_record.rb
+++ b/config/initializers/active_record.rb
@@ -18,3 +18,23 @@ ActiveSupport.on_load(:active_record) do
Audited.configure_database_connection(config)
ActiveRecord::Base.establish_connection(config)
end
+
+module ActiveRecord
@minch
minch / add-sub-view
Created July 24, 2013 14:43
Add sub view
- (IBAction)swipedDown:(id)sender {
CGPoint location = [sender locationInView:self.view];
NSLog(@"swiped down at %f, %f", location.x, location.y);
NSString *viewName = @"TaskQuickCreateView";
TaskQuickCreateView *view = [[NSBundle mainBundle]
loadNibNamed:viewName
owner:self
options:nil][0];
@minch
minch / new_gist_file
Created July 4, 2013 13:40
Propagate storyboards python script
#
# Script that will propagate changes made in the main en storyboard to the other locales
#
# https://code.google.com/p/edim-mobile/source/browse/trunk/ios/IncrementalLocalization/localize.py
# http://www.youtube.com/watch?v=cF1Rf02QvZQ
# Download the script and create a build phase along the lines of:
python ~/bin/localize-storyboards.py --mainIdiom=en --mainStoryboard=tauntaun/en.lproj/MainStoryboard.storyboard pt fr
@minch
minch / new_gist_file
Created July 4, 2013 12:53
success callback for db chooser
Task *task = self.task;
// Ensure we have the most fresh copy of the task
void (^successCallback)(void) = ^void(void) {
[[task managedObjectContext] refreshObject:task mergeChanges:YES];
// TODO: Do we need to call the segue here?
};
@minch
minch / move-element-to-top.js
Created June 9, 2013 16:02
Animate a list of elements: move (slide) element to the top
// http://jsfiddle.net/uNv8C/
// https://forrst.com/posts/Animated_list_item_reordering_in_jQuery-RR1
$(document).ready(function() {
$('li').click(function() {
// the clicked LI
var clicked = $(this);
// all the LIs above the clicked one
var previousAll = clicked.prevAll();
if Rails.env.features? || Rails.env.test?
ActiveRecord::Base.class_eval do
class << self
def delete_all_of_all
@model_subclasses_for_delete_all_of_all.each do |klass|
klass.delete_all
end
end
def inherited_with_model_tracker(subclass)
@model_subclasses_for_delete_all_of_all ||= []
>> require 'sanitize'
=> []
>> s="<p>\r\n</p>"
=> "<p>\r\n</p>"
>> Sanitize.clean(s)
=> "&#13;\n"
>> exit