Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Andrea andycandrea

View GitHub Profile
@andycandrea
andycandrea / snakeclone.py
Created Feb 8, 2014
A simple clone of the popular game "Snake" I made shortly after getting my Raspberry Pi and diving into Linux for the first time several years ago.
View snakeclone.py
#!/usr/bin/env python
"""
A simple clone of the game Snake made to expose myself to Python/Pygame. Inspired by the guide in
the Raspberry Pi User Guide by Eben Upton and Gareth Halfacree, though I did make some changes
based on my preferences and coding style.
"""
import pygame, sys, time, random
from pygame.locals import *
@andycandrea
andycandrea / resources.md
Last active Jul 10, 2018 — forked from zporter/resources.md
A list of resources for learning Rails and relevant technologies
View resources.md

A list of resources that aspiring Rails developers can use to learn Rails and other relevant technologies. This list includes some resources that I see recommended all over the web--not all of which I like--as well as some hidden gems that I've found valuable. This list is intended to supplement my blog post here.

Ruby

  • Codecademy
    • One of the more well-known sites to offer interactive programming tutorials, Codecademy is probably best utilized by those who are pretty new to programming, though the Ruby tutorial is good for teaching Ruby syntax and eventually gets into some less trivial material.
  • Try Ruby
    • Pretty similar to Codecademy. Once again, it's beginner-friendly, though, as someone who knew about object-oriented programming beforehand, I found it somewhat annoying to use, as there's no page with links to the individual exercises (at le
@andycandrea
andycandrea / finder.rb
Created Sep 29, 2016
Compares the git log of two branches to find tasks represented in one but not the other
View finder.rb
# Very rough draft
# TODO: Clean up, extract into multiple objects and then convert to a
# gem/executable.
class TaskFinder
def initialize(outdated_branch, updated_branch)
@outdated_branch = outdated_branch
@updated_branch = updated_branch
end
def updated_tasks_and_branches
@andycandrea
andycandrea / .rubocop.yml
Last active Aug 29, 2015
Default .rubocop.yml file
View .rubocop.yml
# This file should be placed in the root directory of an application using
# the Rubocop gem. For a sense of the most common Rubocop complaints in your
# project, run `rubocop --format offenses` to see a list of the most common
# issues. In addition, you can run rubocop -a to allow Rubocop to autocorrect
# some of the issues it detects. On one project, this made several thousand
# changes and led to only two issues, one from the Lint/DeprecatedClassMethods
# cop and one from Style/Blocks.
# For use with rubocop-rspec gem
require: rubocop-rspec
@andycandrea
andycandrea / guess.py
Last active Aug 29, 2015
Python Guessing Game for TotT
View guess.py
import random
target = random.randint(1,100)
#print target
for i in range(5):
print "Guess a number between 1 and 100 (inclusive): "
guess = raw_input()
guess = int(guess)
print guess
@andycandrea
andycandrea / hackernews.py
Created Feb 28, 2014
Get the most recent stories on HackerNews
View hackernews.py
import sys
from hn import HN
hn = HN()
print "Enter number of stories you'd like to view: "
n = raw_input()
while not n.isdigit():
print "Enter an integer: "
n = raw_input()
n = int(n)
@andycandrea
andycandrea / simpleshell.c
Last active Aug 29, 2015
A simple Linux shell and one of my first projects written in C. It gave me my first real experience with pointers, structs and memory management, as well as fork() and exec().
View simpleshell.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include <sys/stat.h>
/*
* This program works as a simple Linux shell. Linux commands with up to four arguments are supported,
@andycandrea
andycandrea / guess.js
Created Feb 7, 2014
Basic JS Guessing Game created for use with TotT (Tools of the Trade - a series of lectures at UNC intended to supplement the CS curriculum)
View guess.js
/*
JS guessing game that picks a random number between 1 and 100 and prompts the user for up to five guesses.
The program then prints if the correct number is less than, greater than or equal to the guess. If five
guesses are completed without getting the right number, a loss message is output.
*/
var correct = Math.floor(Math.random()*100)+1;
console.log(correct);
var readLine = require('readline'), rl = readLine.createInterface(process.stdin, process.stdout);
View server.js
var http = require('http');
var server = http.createServer(function(req,res) {
res.writeHead(200, {'Content-Type':'text/plain'});
res.end('Hello World\n');
});
server.listen(1337);
console.log('Server running at http://192.168.33.10:1337/');