This file contains 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 "HTTPClient.h" | |
#import "KSDeferred.h" | |
@interface HTTPClient () | |
@property (strong, nonatomic) NSURLSession *session; | |
@property (strong, nonatomic) NSOperationQueue *mainQueue; | |
@end | |
@implementation HTTPClient |
This file contains 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 FooController < ApplicationController | |
respond_to :json | |
def show | |
resource = SomeModelWithErrors.new | |
respond_with resource, serializer: MySerializer | |
end | |
end | |
This file contains 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
module LpcFrameParser | |
extend self | |
BITS = [4,1,6,5,5,4,4,4,4,4,3,3,3] | |
def hexify(data) | |
bit_pattern = data.map do |frame| | |
frame.map.each_with_index do |d, index| | |
bits = d.to_s(2) | |
while bits.length < BITS[index] | |
pad_with_zero(bits) |
This file contains 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
def converted | |
low_pass!(buffer, 4000) | |
new_number_of_samples = ((8000.0 / 44100.0) * number_of_samples).ceil | |
period = 1 / buffer.sample_rate.to_f | |
new_period = 1 / target_sample_rate.to_f | |
new_number_of_samples.times do |m| | |
sum = 0 | |
number_of_samples.times do |n| |
This file contains 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 Webpage < ActiveRecord::Base | |
belongs_to :dropdown | |
has_many :contents, :order => "parent_id, layout_order" | |
end | |
class Content < ActiveRecord::Base | |
belongs_to :element | |
belongs_to :webpage | |
end | |
This file contains 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
module WebpagesHelper | |
def display_html_content(contents, mode = nil) | |
completed_elements, dropzone_id_list, sortable_list, output = [], [], [], [] | |
contents.map do |c| | |
unless completed_elements.include?(c.id) | |
result = get_nested_elements(c, contents, completed_elements, dropzone_id_list, sortable_list, mode) |
This file contains 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
require 'polaroid.rb' |
This file contains 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
def shipping_label | |
@from_address = Setting.find_by_name("shipping_from_address").address | |
@to_address = Address.find(params[:file_name].split("_").last) | |
prawnto :prawn => { | |
:page_layout => :landscape, | |
:page_size => [79.2, 252.0], | |
:left_margin => 0, | |
:right_margin => 0, | |
:top_margin => 0, |
This file contains 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
acts_as_fleximage do | |
image_directory "/media/master_images" | |
use_creation_date_based_directories true | |
# image_storage_format :jpg # the plugin is handling this now | |
require_image true | |
missing_image_message 'is required' | |
invalid_image_message 'was not a readable image' | |
# default_image_path 'public/images/image_not_available.png' | |
default_image nil |
This file contains 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
def file_path | |
# -- I changed this line from: -- | |
# "#{directory_path}/#{id}.#{self.class.image_storage_format}" | |
"#{directory_path}/#{id}.#{self.server_format}" | |
end | |
def pre_save | |
if @uploaded_image | |
# perform preprocessing | |
perform_preprocess_operation |
OlderNewer