Filter lines by matching string or regex in Sublime

Nice little Sublime plugin by davidpeckham that allows you to find all lines matching a string or a regular expression in Sublime. After installing, on Mac, you’ll search to include lines with Regex ⌘+K then ⌘+R. That will bring up the search box. To include lines with a string use ⌘+K then ⌘+S.

Plugin available at https://github.com/davidpeckham/sublime-filterlines

Remove Duplicates From List – Quick and Easy

I needed a quick way to take my several thousand plus list of numbers and remove all duplicates. Just a one off task where I didn’t care about the original order of the list, only that there should be no duplicates. Enter python! Here’s how I did it.

  1. Open Terminal on Mac
  2. Type “python” and execute
  3. Format my numbers in an array like [39213123667, 532092995671, 659203651894,… in a text editor for easy copy and paste
  4. Use python’s set to remove duplicates and then convert back to a list and print out:
listWithDuplicates = [39213123667, 532092995671, 659203651894,...

# sets are unordered collections of distinct objects
deduplicated = list(set(listWithDuplicates))

# used this to see how many duplicates were removed
len(listWithDuplicates)
len(deduplicated)

# print out list to start doing real work
deduplicated

Amazon package not delivered how to

For those times when you find yourself yelling “My package never arrived!”…

When your Amazon shipment has been marked as delivered but you haven’t received it yet, bet sure to follow the steps outlined at https://www.amazon.com/gp/aw/help/id=201117310

After following those steps, if you still don’t have the package in your hands, visit http://amazon.com/gp/help/customer/contact-us/ and follow the steps to contact Amazon support about your missing package.

contact-amazon-package-not-delivered

In my case, the carrier had marked the package as delivered on a Friday and upon contacting Amazon, they said it would be delivered by end of day Monday.

Pass parameter to Ajax call to use after response returns

Let’s say I have some data I want to pass along with an ajax call to use when the response comes in. You can pass round trip parameters in your jQuery ajax call by adding them to the options object like this

$.ajax({
 url: 'www.example.com/some-api/',
 dataType: "json",
 roundTripVariable: 'Weeeeee!',
 success: function(data, textStatus, jqXHR) {
 // will print 'Weeeeee!' to the console
 console.log( this.roundTripVariable );
 }
});