Skip to content

Instantly share code, notes, and snippets.

View yusufcakal's full-sized avatar
:octocat:
Leave your code better than you found it

Yusuf Çakal yusufcakal

:octocat:
Leave your code better than you found it
View GitHub Profile
@yusufcakal
yusufcakal / index.php
Created August 21, 2017 11:03
Cumhuriyet University Cafeteria List Meals Api
<?php
function curlFunc($url)
{
$cd = curl_init();
curl_setopt($cd, CURLOPT_URL, $url);
curl_setopt($cd, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cd, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($cd, CURLOPT_REFERER, 'http://www.google.com.tr/');
@yusufcakal
yusufcakal / Company.java
Created October 3, 2017 13:45
Medium Post
public class Company {
private String name, phone, address;
public Company(String name, String phone, String address) {
this.name = name;
this.phone = phone;
this.address = address;
}
// getter and setter methods.
@yusufcakal
yusufcakal / Company.java
Created October 3, 2017 17:40
Mudium Oost
package pojo;
/**
* @author Yusuf
* @since 02.10.2017
*/
public class Company {
private String name, phone, address;
@yusufcakal
yusufcakal / Main.java
Created October 3, 2017 17:41
Medium Post
Company company = new Company.Builder("Google")
.setAddress("San Francisco").
build();
@yusufcakal
yusufcakal / User.java
Created October 4, 2017 17:55
Medium Post
package pojo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Kullanıcı pojo sınıfımız.
* @author Yusuf Çakal
* @since 14 Ağustos 2017
@yusufcakal
yusufcakal / Job.java
Created October 4, 2017 17:59
Medium Post
package pojo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* İş pojo sınıfımız.
* @author Yusuf Çakal
* @since 14 Ağustos 2017
@yusufcakal
yusufcakal / Main.java
Created October 4, 2017 18:01
Medium Post
package main;
import pojo.Job;
import pojo.User;
public class Main {
public static void main(String[] args) {
User user = new User(1,"Yusuf","yusufcakal","123456");
Job job = new Job("Computer Science", "Engineer");
@yusufcakal
yusufcakal / Main.java
Created October 4, 2017 18:03
Medium Post
try {
File file = new File("C:\\Users\\Yusuf\\IdeaProjects\\jaxb\\data.xml");
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
User user = (User) unmarshaller.unmarshal(file);
System.out.println(user + " " + user.getJob());
} catch (JAXBException e) {
e.printStackTrace();
}
package wrapper;
import pojo.User;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Kullanıcı listesi için gerekli wrapper (yardımcı, destekleyici) sınıfımız.
* @author Yusuf Çakal
@yusufcakal
yusufcakal / Main.java
Created October 4, 2017 18:05
Medium Post
User user = new User(1,"Yusuf","yusufcakal","123456");
Job job = new Job("Computer Science", "Engineer");
user.setJob(job);
User user1 = new User(2,"Fatih","fatihsimsek","123456");
Job job1 = new Job("Computer Science", "Enginerr");
user1.setJob(job1);
List<User> userList = new ArrayList<>();
userList.add(user);