Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / Timer.cpp
Created June 15, 2013 03:32
C++ Timer
/*
Name Javier Chavez
email [email protected]
oct 31,2012
*/
#include "Timer.h"
#include <stdlib.h>
Timer::Timer()
{
@kf4x
kf4x / abqdata.md
Last active December 18, 2015 01:28
Example query of ABQ data JSON

Instead of posting links like ABQ did, I'll explain how the server works that way you can build your own queries.

###YouTube Made 2 videos to get started

YouTube Playlist ABQOpenData

Root Folder

package com.bugcloud.android.slider;
import android.app.Activity;
import android.util.Log;
import android.view.MotionEvent;
public class SlidableActivity extends Activity {
protected static final String TAG = "SlidableActivity";
private static final int ACTION_TYPE_DEFAULT = 0;
private static final int ACTION_TYPE_UP = 1;
@kf4x
kf4x / jar.txt
Created March 29, 2013 21:55
creating jar with files
jar cvf ProfileConverter.jar *.class \image\*.jpg \sound\*.mdi
@kf4x
kf4x / gist:4598354
Created January 22, 2013 20:58
adding jar to netbeans android pro
<target name="-pre-jar">
<copy todir="${build.classes.dir}">
<fileset dir="${external.libs.dir}" />
</copy>
</target>
@kf4x
kf4x / gist:4248962
Created December 10, 2012 07:00
Stuff i forget
bundle
rake db:create:all
rake db:migrate