Skip to content

Instantly share code, notes, and snippets.

View stevenpetryk's full-sized avatar

Steven Petryk stevenpetryk

View GitHub Profile
// :::::::::::::::::::::::: LICENSE AND COPYRIGHT NOTICE :::::::::::::::::::::::
// Copyright (c) 2013 Andrew Hamon. All rights reserved.
//
// This file is part of FFT-LED-Visualization. FFT-LED-Visualization is
// distributed under the MIT License. You can read the full terms of use in the
// LICENSE file, or online at http://opensource.org/licenses/MIT.
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <Adafruit_NeoPixel.h>
#define sampleRate 1
#define progChangeDuration 1000
#define threshold 20
void setup()
{
pinMode(2, INPUT);
}
void loop()

Web design path

  • [HTML][html]
  • [CSS][css]
  • [JavaScript][javscript]

You can stop there if you only want to learn basic web design. If you want to make web-apps and stuff, these are highly recommended:

  • [Ruby][ruby]
  • [Sass][sass] (think of this as super-powered CSS)
  • [CoffeeScript][coffee] (think of this as super-powered and better-looking JavaScript)
@stevenpetryk
stevenpetryk / better_setinterval.coffee
Created July 2, 2014 13:29
This is quite a useful improvement over the regular Javascript setInterval()
# Usage:
# every 250, (stop) ->
# stop() if condition
# # some logic...
#
# Still preserves original behavior if you want to do that:
# interval_id = every 250, someFunction
# clearInterval(interval_id)
every = (time, fn) ->
int earliestHitInChain(Attack * attacks[]) {
int i;
for(i = MAX_ATTACKS-1; i > 0; i--) {
if(attacks[i] != NULL && attacks[i]->result == HIT && attacks[i-1]->result == MISS)
return i;
}
return -1; // didn't find anything
}
@stevenpetryk
stevenpetryk / bash_prompt.sh
Last active August 29, 2015 14:10
My bash prompt
# spetryk in ~/code $
PS1='\n\[\e[1;34m\]\u\[\e[m\] in \[\e[1;34m\]\w\[\e[m\]\n\[\e[1;32m\]>\[\e[m\] \[\e[37m\]'
void DrawSquares( Graphics canvas )
{
canvas.setColor(Color.BLACK);
for( int nRow=0; nRow<NUMROWS; nRow++ )
{
for( int nCol=0; nCol<NUMCOLS; nCol++ )
{
canvas.drawRect( BOARDLEFT + nCol * SQUAREWIDTH,
BOARDTOP + nRow * SQUAREHEIGHT, SQUAREWIDTH, SQUAREHEIGHT );
if ARGV[0]
tle = File.open(ARGV[0]).read
tle_line_1 = tle.lines[0]
tle_line_2 = tle.lines[1]
else
print 'Line 1 > '
tle_line_1 = gets.chomp
print 'Line 2 > '
tle_line_2 = gets.chomp
end
var gulp = require('gulp');
var sequence = require('run-sequence');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber')
var stylus = require('gulp-stylus');
var nib = require('nib');
var jeet = require('jeet');
var browserify = require('browserify');

COP 3503 Review

Hash tables

Linear (and quadratic) put and get

public class LinearHashTable {
  void put(DataStruct ds) {
    // For the test, we don't have to worry about table expansion.
    int hv = getHashValue(ds.getKey());