I hereby claim:
- I am jcutrell on github.
- I am jcutrell (https://keybase.io/jcutrell) on keybase.
- I have a public key ASDGeZWubxMA-dEx5ByX3eDJ4zzRafoPc4gPkVJSxOKh2Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Started GET "/admin/users/2/accept_by_token?user_email=bob%40whiteboard.is&user_token=SkszoGBFgz_uhP-xQU3g" for 127.0.0.1 at 2016-06-02 13:50:19 -0400 | |
Processing by Admin::UsersController#accept_by_token as HTML | |
Parameters: {"user_email"=>"[email protected]", "user_token"=>"SkszoGBFgz_uhP-xQU3g", "id"=>"2"} | |
[1m[35mUser Load (0.5ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["email", "[email protected]"]] | |
[1m[36mCACHE (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT 1[0m [["email", "[email protected]"]] | |
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 2]] | |
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_2[0m | |
[1m[35mSQL (0.3ms)[0m UPDATE "users" SET "application_status" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["application_status", 3], ["updated_at", "2016-06-02 17:50:19.320888"], ["id", 2]] | |
[1m[36m (0.1ms)[0m [1mRELEASE SA |
That code violates Tell, Don't Ask..
You could also say it exhibits the feature envy smell.
Furthermore, "checking systems" shouldn't, necessarily, sound an alarm. The method both checks and responds to a state, and therefore has side effects. You might prefer to ONLY check the system without sounding an alarm.
(Violating Tell, Don't Ask and having feature envy are pretty much two sides of the same coin.)
class BaseJob < ActiveRecord::Base | |
belongs_to :child_job, polymorphic: true | |
has_attached_file :header_image, :styles => { :medium => "800x500#" } | |
validates_attachment_content_type :header_image, :content_type => /\Aimage\/.*\Z/ | |
validates :title, presence: true | |
validates :prompt_html, presence: true |
@clip_object.clips.each_with_index do |clip, i| | |
# puts clip[:video][:media_url] | |
gcdq = Dispatch::Queue.concurrent(:high) | |
gcdq.async { | |
# por = S3PutObjectRequest.alloc.initWithKey(clip[:aws_path], inBucket:"southtree_dvds") | |
# por.contentType = "video/mp4" | |
# por.filename = clip[:video][:media_url].to_s | |
asset_url = clip[:video][:reference_url] | |
assets_library.assetForURL(asset_url, resultBlock: lambda { |asset| | |
# clip[:raw_data] = rawData |
def assets_library | |
@_assets_library ||= ALAssetsLibrary.alloc.init | |
end | |
@foo.clips.each_with_index do |clip,i| | |
# clip[1][:reference_url] refers to a video file chosen via BW::Device.camera.any.picture(media_types: [:movie]) do |result| | |
asset_url = clip[1][:reference_url] | |
assets_library.assetForURL(asset_url, resultBlock: lambda { |asset| | |
selectedAsset = asset | |
byteArraySize = selectedAsset.defaultRepresentation.size |
- (NSData *)getDataPartAtOffset:(NSInteger)offset { | |
__block NSData *chunkData = nil; | |
if (fileAsset_){ | |
static const NSUInteger BufferSize = PART_SIZE; // 5 MB chunk | |
ALAssetRepresentation *rep = [fileAsset_ defaultRepresentation]; | |
uint8_t *buffer = calloc(BufferSize, sizeof(*buffer)); | |
NSUInteger bytesRead = 0; | |
NSError *error = nil; | |
@try |
class StripeTransaction < ActiveRecord::Base | |
has_many :line_items | |
accepts_nested_attributes_for :line_items | |
belongs_to :user | |
belongs_to :stripe_card | |
end |
// Examples for using socat (and filan) | |
//"$" means normal user, "#" requires privileges, "//" starts a comment | |
/////////////////////////////////////////////////////////////////////////////// | |
// similar to netcat | |
// connect to 10.1.1.1 on port 80 and relay to and from stdio |
class ClassRegistrationsController < InheritedResources::Base | |
before_filter :authenticate_user! | |
def permitted_params | |
params.permit(:class_registration => [ | |
:person_id, :classdate_id, | |
:document_assignments_attributes => [ | |
:uploaded_document_id, | |
:uploaded_document => [ | |
:document, :owner_type, :owner_id |