fuckyeahterminals

How to fix Mac Terminal copying

So I don’t know about you guys but I fucking hate it when I’m trying to copy something from the terminal and Mac decides the Font and Color Attributes are something I want. No fuck you, I don’t want that. Why would anyone want that. I just want the text. This is how you fix that

    defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.no-attributes

dump this line on your terminal, no more shitty copying for you. My day got exponentially better. OR I’m pretty sure it’s in some settings bullshit where I have to click on some weird tab somewhere, ain’t no one got time for that shit.

Extending NSArray to Add Some Much Needed Functionality

So a lot of scripting languages will often times let you do something like this

array1 = [1,2,3] 
array2 = [3,4,6] 
... 
arrayN = [12,23,34] 
superarray = array1 + array2 + ... + arrayN 

And often times you might not need to do this in iOS but if for some reason you’re collecting data or working with many arrays and want to merge everything together, trying to go through each array individually to add it to some super array everything might be cumbersome.

Here’s how to get passed this:

NSArray+Utils.h

#import <Foundation/Foundation.h>

@interface NSArray (Utils)

+ (NSArray *) arrayFromArrays:(NSArray *)otherArrays,...;

@end

NSArray+Utils.m

#import "NSArray+Utils.h"

@implementation NSArray (Utils)

+ (NSArray *) arrayFromArrays:(NSArray *)otherArrays,... {
    NSMutableArray* result = [[NSMutableArray alloc] initWithArray:otherArrays];
    va_list args;
    va_start(args, otherArrays);
    NSArray *next;
    while((next = va_arg(args, NSArray*))) {
        [result addObjectsFromArray:next];
    }
    va_end(args);
    return result;
}

@end

Okay whats going on here. Well a couple thingsĀ  but it’s simple I promise.

So basically we’re allowing to pass into the arguments n arguments that are nil terminated (given the while loop) and adding them to an array and using theĀ  va_list, va_start, var_arg marcros (you can find what they do at cplusplus.com) to iterate through the array of pointer till we hit nill and then return the results.

Simple to do, and SUPER useful. You would use it like this:

    [NSArray arrayFromArrays:array1, array2, ..., arrayN, nil];

Instead of having to write a million addObjectFromArray on an NSMutableArray

Haskoin

It’s about time.

ask-stack

This should be plugin for all major IDE’s, this is forward thinking.

Pretty Slick

aspnet

Insane, I just thought it was all talk. I didn’t realize Microsoft had /actually/ posted their source code on github

count it off!

Things that don’t change

Deadlines and Deliverables, in or out of college, that shit always means crunch time. I think I’ve worked 40 hrs in the last 3 days easily.

So much coding…