Skip to content

Instantly share code, notes, and snippets.

View ajdeguzman's full-sized avatar
coffee.setName("Java");

Aljohn De Guzman ajdeguzman

coffee.setName("Java");
View GitHub Profile
@ajdeguzman
ajdeguzman / gist:d1c09a675034552f5c88d7a0f86e43cd
Last active February 14, 2017 04:03 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@ajdeguzman
ajdeguzman / gist:af90a4cc65629bb810e4
Last active February 29, 2016 07:43
Socket IO Android Chat App Server Code
/**
* Created by wogaljohn on 2/29/2016.
*/
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/',function(req,res){
res.sendFile(__dirname+'/index.html');
})
public function debug_to_console($data) {
if(is_array($data) || is_object($data)) {
echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
} else {
echo("<script>console.log('PHP: $data');</script>");
}
}
# Basic
# generate:model
# generate:view
# generate:controller
# generate:seed
# generate:migration
# generate:pivot
# generate:resource
# generate:scaffold
## Migration
# Create a migration to create a table named 'posts'
php artisan generate:migration create_posts_table
# Create a migration to add a field named 'user_id' to the 'posts' table
php artisan generate:migration add_user_id_to_posts_table
# Create a migration to remove the 'user_id' field we just created
php artisan generate:reomve_user_id_from_posts_table
@ajdeguzman
ajdeguzman / Image
Created October 15, 2014 13:30
Getting image
ParseFile fileObject = (ParseFile)obj.get("image");
fileObject.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
bmp = BitmapFactory.decodeByteArray(data, 0,data.length);
imgView.setImageBitmap(bmp);
} else {
Toast.makeText(getActivity(), "There was a problem downloading the data." , Toast.LENGTH_SHORT).show();
}
}
@ajdeguzman
ajdeguzman / gist:01910889f7d71d987afb
Created October 13, 2014 13:46
Android Gestures
@Override
public void onSwipe(int direction) {
switch (direction) {
case SimpleGestureFilter.SWIPE_RIGHT :
break;
case SimpleGestureFilter.SWIPE_LEFT :
startActivity(new Intent(this, SecondActivity.class));
break;
case SimpleGestureFilter.SWIPE_DOWN :
break;
<?php
session_start();
include('conn.php');
if(isset($_GET['subj_id'])){$_SESSION['subj_id'] = $_GET['subj_id'];}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link type = "text/css" rel = "stylesheet" href="finalproj.css" />
package com.example.mp1;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;