Skip to content

Instantly share code, notes, and snippets.

View SeanPlusPlus's full-sized avatar

Sean Stephenson SeanPlusPlus

View GitHub Profile
a,200
a,202
a,205
b,302
b,60
b,3100
c,50
c,200
#!/usr/bin/env python
import collections
def main():
di = {}
f = file('in.txt', 'r')
for line in f:
k = line.rstrip().split(',')[0]
v = line.rstrip().split(',')[1]
@SeanPlusPlus
SeanPlusPlus / challenge3.js
Last active August 29, 2015 14:16
Report the frequency of each character in the string "hello world". Sort the characters from most to least common. A tie break should go to the character lower in the alphabet. Wrap your output in a ul tag with an li for each row.
// https://github.com/SeanPlusPlus/WebDevTemplates/blob/master/hello-world/hello-js/CHALLENGES.md #3
'use strict';
(function(){
var msg = 'hello world';
var arr = msg.replace(' ', '').split('');
var obj = {};
arr.forEach(function(chr) {
@SeanPlusPlus
SeanPlusPlus / challenge1-intermediate.js
Last active August 29, 2015 14:16
hello js challenge 1
var msgString = 'hello world';
var msgArray = msgString.replace(' ', '').split('');
var characterCount = {};
msgArray.forEach(function(char) {
if (char in characterCount) {
characterCount[char] += 1;
}
else {
characterCount[char] = 1;
}
@SeanPlusPlus
SeanPlusPlus / keybase.md
Last active August 29, 2015 14:16
keybase.md

Keybase proof

I hereby claim:

  • I am seanplusplus on github.
  • I am seanplusplus (https://keybase.io/seanplusplus) on keybase.
  • I have a public key whose fingerprint is 2016 70BA 7220 A4DC 5140 ED60 EDC2 AD43 B29A 0F4E

To claim this, I am signing this object:

@SeanPlusPlus
SeanPlusPlus / gist:6f6bd45844f5956babff
Last active August 29, 2015 14:16 — forked from dlbewley/gist:a062df2612fb1e4b7e5f
how to merge from upstream

How do I get changes from Sean's sweet repo?

git remote add upstream [email protected]:SeanPlusPlus/WebDevTemplates.git
git fetch upstream
git checkout master
git merge upstream/master

Beware of conflicts

@SeanPlusPlus
SeanPlusPlus / elevator_saga_01.js
Created January 28, 2015 22:53
Elevator Saga Challenge 1
// http://play.elevatorsaga.com/#challenge=1
{
init: function(elevators, floors) {
var elevator = elevators[0]; // Let's use the first elevator
elevator.on("idle", function() {
// The elevator is idle, so let's go to all the floors (or did we forget one?)
elevator.goToFloor(0);
elevator.goToFloor(1);
elevator.goToFloor(2);
@SeanPlusPlus
SeanPlusPlus / pseudo_rando_no_lib.py
Created December 30, 2014 21:35
pseudo_rando_no_lib.py
#!/usr/bin/env python
###############################################################################
def get_pseudo_random_ints(li, total_randoms_needed):
###############################################################################
pseudo_random_ints = []
for idx, char in enumerate(''.join(li)):
if idx < total_randoms_needed:
pseudo_random_ints.append(ord(char))
return pseudo_random_ints
@SeanPlusPlus
SeanPlusPlus / rando.py
Created December 30, 2014 18:40
rando.py
#!/usr/bin/env python
from random import shuffle
def main():
li = ['foo', 'bar', 'baz', 'meh', 'blerg']
shuffle(li)
print li
if __name__ == '__main__':
main()
@SeanPlusPlus
SeanPlusPlus / myFunctions.R
Created December 10, 2014 02:29
myFunctions.R
avgTemp <- function() {
data <- read.csv('hw1_data.csv')
d <- data[data$Ozone>31 & data$Temp>90,]$Solar.R
mean(d[!is.na(d)])
}
above <- function(x, n = 10) {
use <- x > n
x[use]
}