Skip to content

Instantly share code, notes, and snippets.

@kf4x
kf4x / Timer.cpp
Created June 15, 2013 03:32
C++ Timer
/*
Name Javier Chavez
email jchavez589@cnm.edu
oct 31,2012
*/
#include "Timer.h"
#include <stdlib.h>
Timer::Timer()
{
@kf4x
kf4x / gist:5787111
Last active December 18, 2015 12:59
checking for back button
/*
* first press the if statement will be executed and thread will run
*
* second press the else statement will be executed waking the sleep
* key will NOT be 1 therefore calling else and finish
*/
private int timesPressed =0;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// if the back button is pressed
@kf4x
kf4x / tetris
Last active December 23, 2015 06:38
Testing pieces
Piece num: 1
Number of rotations: 0
*
***
edu.cs251.chavezl3.Block@5337e216
edu.cs251.chavezl3.Block@5337e216
edu.cs251.chavezl3.Block@5337e216
edu.cs251.chavezl3.Block@5337e216
Dimention: [3,2]
@kf4x
kf4x / tetris_piece
Created September 21, 2013 18:27
Data structures to represent a Tetris piece.
// 16bit representation (convert hx to bin to see block)
i = [0x0F00, 0x2222, 0x00F0, 0x4444]
j = [0x44C0, 0x8E00, 0x6440, 0x0E20]
l = [0x4460, 0x0E80, 0xC440, 0x2E00]
o = [0xCC00, 0xCC00, 0xCC00, 0xCC00]
s = [0x06C0, 0x8C40, 0x6C00, 0x4620]
t = [0x0E40, 0x4C40, 0x4E00, 0x4640]
z = [0x0C60, 0x4C80, 0xC600, 0x2640]
@kf4x
kf4x / gist:6692822
Last active December 23, 2015 20:59
//Preliminary notes
/**
*
* when referring to return type
*/
//public means who can see/call this method,
//Dimension2D is the return type
//getDimension is the method name.
public Dimension2D getDimension(){
@kf4x
kf4x / gist:7131112
Created October 24, 2013 03:57
convert HEX to RGB
RRGGBB
R(1)R(2)
R(1)*16 + R(2)
@kf4x
kf4x / master.ucf
Created November 11, 2013 00:57
UCF DIGILENT nexys 3
## This file is a general .ucf for Nexys3 rev B board
## To use it in a project:
## - remove or comment the lines corresponding to unused pins
## - rename the used signals according to the project
## Clock signal
#NET "clk" LOC = "V10" | IOSTANDARD = "LVCMOS33"; #Bank = 2, pin name = IO_L30N_GCLK0_USERCCLK, Sch name = GCLK
#Net "clk" TNM_NET = sys_clk_pin;
#TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 100000 kHz;
@kf4x
kf4x / atest.py
Last active August 29, 2015 13:58
Load data file as json
import json
# open file
json_file = open("data.json")
# load json from file
json_data = json.load(json_file)
# total marks
print len(json_data['placemarks'])
@kf4x
kf4x / secrets
Created May 16, 2014 22:02
Google Urls
tranit api.
http://maps.googleapis.com/maps/api/directions/json?origin=35.080935,-106.623872&destination=35.079812,-106.604904&sensor=false&departure_time=1400254800&mode=transit
@kf4x
kf4x / HWTemplate.tex
Last active August 29, 2015 14:15 — forked from dcernst/HWTemplate.tex
% --------------------------------------------------------------
% This is all preamble stuff that you don't have to worry about.
% Head down to where it says "Start here"
% --------------------------------------------------------------
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}