This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // AMScanViewController.h | |
| // | |
| // | |
| // Created by Alexander Mack on 11.10.13. | |
| // Copyright (c) 2013 ama-dev.com. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import <AVFoundation/AVFoundation.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Highcharts CheatSheet Part 1. | |
| // Create interactive charts easily for your web projects. | |
| // Download: http://www.highcharts.com/download | |
| // More: http://api.highcharts.com/highcharts | |
| // 1. Installation. | |
| // Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks. | |
| // <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| // <script src="https://code.highcharts.com/highcharts.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stats = Sidekiq::Stats.new | |
| stats.queues | |
| stats.enqueued | |
| stats.processed | |
| stats.failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| /// Parse RFC 3339 date string to NSDate | |
| /// | |
| /// :param: rfc3339DateTimeString string with format "yyyy-MM-ddTHH:mm:ssZ" | |
| /// :returns: NSDate, or nil if string cannot be parsed | |
| public func dateForRFC3339DateTimeString(rfc3339DateTimeString: String) -> NSDate? { | |
| let formatter = getThreadLocalRFC3339DateFormatter() | |
| return formatter.dateFromString(rfc3339DateTimeString) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # As used with CanCan and Devise | |
| class ApplicationController < ActionController::Base | |
| protect_from_forgery | |
| include ErrorResponseActions | |
| rescue_from CanCan::AccessDenied, :with => :authorization_error | |
| rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found | |
| before_filter :authenticate! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Run this in the F12 javascript console in chrome | |
| // if a redirect happens, the page will pause | |
| // this helps because chrome's network tab's | |
| // "preserve log" seems to technically preserve the log | |
| // but you can't actually LOOK at it... | |
| // also the "replay xhr" feature does not work after reload | |
| // even if you "preserve log". | |
| window.addEventListener("beforeunload", function() { debugger; }, false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ImportJob | |
| include Sidekiq::Worker | |
| sidekiq_options :queue => :import, :retry => false, :backtrace => true | |
| def perform(project_id) | |
| # create master batch | |
| a = Sidekiq::Batch.new | |
| a.description = "Master Batch A" | |
| a.on(:success, "ImportJob#on_success", {"step" => "a"}) | |
| logger.info "Master Batch A starting #{a.bid}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| typealias TableInfo = [String: Any] | |
| typealias TableSectionArray = [TableSection] | |
| typealias TableRowArray = [TableRow] | |
| enum TableRowType { | |
| case Text | |
| case Detail | |
| case Subtitle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get a deserialized object from a delayed job: | |
| 1. Get the delayed_job record using the id: dj = DelayedJob.find(<id>) | |
| 2. Get the handler field from dj: dj.handler | |
| 3. Convert it from YAML: YAML.parse(dj.handler) | |
| 4. You can get the ruby objects that the delayed job was built with by converting that to_ruby and calling the object: | |
| YAML.parse(dj.handler).to_ruby.user | |
| YAML.parse(dj.handler).to_ruby.prospect | |
| YAML.parse(dj.handler).to_ruby.agent | |
| etc. |