Skip to content

Instantly share code, notes, and snippets.

View JaDogg's full-sized avatar
🎧
Working on Yaksha Programming Language - yakshalang.github.io/

JaDoggx86 JaDogg

🎧
Working on Yaksha Programming Language - yakshalang.github.io/
View GitHub Profile
@JaDogg
JaDogg / HTMLEditorCustomizationSample.java
Last active August 29, 2015 14:03 — forked from jewelsea/HTMLEditorCustomizationSample.java
Sample Showing how to add an image to HTMLEditor
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
import javafx.scene.image.Image;
import javax.imageio.ImageIO;
import java.awt.image.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public Image getJavaFXImage(byte[] rawPixels, int width, int height) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ImageIO.write((RenderedImage) createBufferedImage(rawPixels, width, height), "png", out);
@JaDogg
JaDogg / rsctobyte.java
Created July 11, 2014 09:05
Resource to byte Array
try {
InputStream is = this.getClass().getResourceAsStream(
"/classpath/dummy.png");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = is.read(data, 0, data.length)) != -1) {
@JaDogg
JaDogg / Coordinate.java
Last active August 29, 2015 14:03
Kryo & Apache Commons Codec. Object to base64 string serialization (+ JavaFX SimpleStringProperty).
package jadogg.test;
import java.util.List;
import java.util.Optional;
import javafx.beans.property.SimpleStringProperty;
/**
* Coordinate Class
* @author jadogg
*/
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.*;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.BoxBlur;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
@JaDogg
JaDogg / FXMLTime.fxml
Created July 29, 2014 14:50
JavaFX TimeLine
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="111.0" prefWidth="266.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="FXMLTimeController">
<children>
@JaDogg
JaDogg / Euler2.c
Created August 13, 2014 11:05
Euler2
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int sum_even_fibonacci(int limit, int *steps_taken) {
int a = 1, b = 0;
int sum = 0;
int even_fibonacci = 0;
for (int steps = 1; even_fibonacci < limit; steps++) {
assert(a % 2); // Fibonacci just before even Fibonacci
@JaDogg
JaDogg / Question1.md
Last active August 29, 2015 14:05
Questions to see if within scope

Once I called a favor from a friend and I got called for an interview.

I went there expecting an interview for an internship, however as it turned out it was for a bigger position. I realized this just before the interview and I thought it might be impossible.

During the interview I was asked lot of questions, And whenever I receive a question I do not know the answer, I simply said I don't know (This happened a lot). There was also a question where I had to write some code, I did answer it but the interviewer said It was inefficient, I understood the scenario and tried again, But I could not come up with another solution so I gave up. The interview (which was face to face) was about 1hr 30min long. at around 50 min time I was overwhelmed.

I was not hired, but I learned that the interviewer said to my friend that I was arrogant and I did not take the interview seriously.

I have another interview soon, how do I say I don't know (or give up) without sounding arrogant ? Is there some big point I'm f

@JaDogg
JaDogg / q.md
Last active August 29, 2015 14:05
Q & A for internship interview

##Can you tell us about your self ?

Hi, I'm Bhathiya. I love code, and I love code review. I don't know everything, but I am comfortable with Java-stuff. I understand you guys use C++-whatnot, which I am excited to dive in to and learn.

##What are the projects you have done ?

###Research Project

  1. for the third year research project we built a card game. me and another member was the only people to receive A passes from the whole batch (other projects were not bad we were just exceptional).
  2. We were able to achieve it by
  • Good teamwork. (we eventually got the members who were bad in programming to contribute)
@JaDogg
JaDogg / JSONSplit.java
Created October 19, 2014 08:36
JSON Split
package jsonsplit;
import java.util.ArrayList;
import java.util.List;
/**
* JSON Split
* @author Bhathiya
*/
public class JSONSplit {