Skip to content

Instantly share code, notes, and snippets.

View JRJurman's full-sized avatar

Jesse Jurman JRJurman

View GitHub Profile
@JRJurman
JRJurman / LinkedListProb.py
Last active January 3, 2016 23:09
Implement an algorithm to find the nth to last element of a singly linked list
"""
Implement an algorithm to find the nth to last element of a singly linked list
"""
# Assumes that list is at least n elements long
def solve(lnkList, index):
nex = ".nextNode"*(index+1) # index=2 => nex = .nextNode.nextNode.nextNode
cNode = lnkList.head
while (eval("cNode"+nex)!=None): # eval "cNode.nextNode.nextNode.nextNode"
cNode = cNode.nextNode
@JRJurman
JRJurman / RubyHash.rb
Last active August 29, 2015 13:57
Odd ruby behavior with Hashes
b = Hash.new( "FOO" ) #=> {}
b[0] #=> "FOO"
b[0].chop! #=> "FO"
b #=> {}
b[0] #=> "FO"
b[1] #=> "FO"
b[0] = "BAR" #=> "BAR"
b #=> {0=>"BAR"}
b[0].chop! #=> "BA"
var urlList = [
"http://www.audiosparx.com/sa/archive/Keyboard/Piano-electric/Ambush-Piano-Loop/534060",
"http://www.audiosparx.com/sa/archive/Jazz/Jazz-Funk/Ambush-Short/534117"
];
function playSong() {
url = urlList.pop()
var aWin = open(url);
var time = ""
var total_time = 0
<span id="countdown" class="timer"></span>
<script>
var seconds = 60;
function secondPassed() {
    var minutes = Math.round((seconds - 30)/60);
    var remainingSeconds = seconds % 60;
    if (remainingSeconds < 10) {
        remainingSeconds = "0" + remainingSeconds; 
    }
    $('#countdown').text(minutes + ":" + remainingSeconds);
@JRJurman
JRJurman / JobServices.java
Last active August 29, 2015 14:10
Restful API
public interface JobServices {
// POST: /jobs
/**
* result: a new job post is created, belonging to the current user
* response: JSON object with same parameters as request, plus newly assigned jobID
* conditions: none
*/
@JRJurman
JRJurman / poke.js
Created December 20, 2014 21:16
Pokemon Scrapping
number = document.querySelector(".stats-footer").querySelector("span").textContent.split("/")[0];
name = document.querySelector("h1").textContent;
type = document.querySelector(".card-basic-info").querySelector(".energy").className.substr(12);
stgStr = document.querySelector(".card-type").querySelector("h2").textContent;
stage = stgStr.substring(0, stgStr.length - 8);
if (stage !== "Basic") {
@JRJurman
JRJurman / folderify.rb
Created February 23, 2015 22:39
Making images into folders
Dir.glob("*.png").each do |img|
fimg = img.sub( /\.\S*/, "" )
puts fimg
`mkdir #{fimg}`
`touch #{fimg}/full_text.txt`
`mv #{img} #{fimg}/full.png`
`cp #{fimg}/full.png #{fimg}/thumb.png`
`sips #{fimg}/thumb.png --resampleHeightWidth 400 570`
end
@JRJurman
JRJurman / processing.py
Created March 14, 2015 03:11
Radiometry Lab 5
# Lab5 Radiometry Code (Python Variant)
# Created By Jesse Jurman
import numpy as np
import matplotlib.pyplot as plt
import math
fileNames = ["sample", "reference", "dark", "JESSE_cal_coef_cc_resamp"]
# this program takes time, so I'm building a loading bar
def bar( prog, limit, bar_size=80 ):
@JRJurman
JRJurman / processing.py
Created March 20, 2015 17:16
Radiometry Lab 6
# Lab6 Radiometry Code (Python Variant)
# Created By Jesse Jurman
import numpy as np
import matplotlib.pyplot as plt
import math
import cmath
from collections import OrderedDict
files = {
'DSC8364': {
@JRJurman
JRJurman / django-install.md
Last active September 10, 2015 01:27 — forked from kocsenc/osx-django.md
Installing Django

Install Django on OS X or Windows

For OSX

Django can be tricky to install on OS X if you don't use the appropriate tools. I am using OS X 10.10 but any lower version should work.

NOTE: I assume you have NOT tried to install Python 3 in some other way, if so delete as much as you can (DO NOT DELETE PYTHON 2, THIS IS REQUIRED FOR YOUR SYSTEM TO RUN PROPERLY).

  1. Install homebrew by running the following:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew doctor This will show you if everything is gucci. If it's not cool, then attempt to fix the issues.