Skip to content

Instantly share code, notes, and snippets.

View mikejoyceio's full-sized avatar
🔌
Plugged In

Mike Joyce mikejoyceio

🔌
Plugged In
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mikejoyceio on github.
  • I am mikejoyce (https://keybase.io/mikejoyce) on keybase.
  • I have a public key ASAiLrti7pWKSCbbArffUCZy4aNv6QCzxUgii6MdqaABDgo

To claim this, I am signing this object:

@mikejoyceio
mikejoyceio / Access Object Property Values by Index
Created June 10, 2015 11:36
Access an array of object property values by index.
var data = [
{ property: '01' },
{ property: '02' },
{ property: '03' },
{ property: '04' },
{ property: '05' }
];
for (obj in data) {
data[obj][Object.keys(data[obj])[0]];
@mikejoyceio
mikejoyceio / random
Last active August 29, 2015 14:15
Python function that returns a specified number of random items from an iterable
import random
def random_items(itr, int):
list = []
count = 0
while count < int:
rand = random.choice(itr)
list.append(rand)
count += 1
return list
@mikejoyceio
mikejoyceio / tuples
Last active August 29, 2015 14:15
Pack iterables into a tuple
def combo(itr1, itr2):
list = []
count = 0
for _, item in enumerate(itr1):
tup = item, itr2[count]
list.append(tup)
count += 1
return list