Skip to content

Instantly share code, notes, and snippets.

View altayalp's full-sized avatar

İzzet Ögetürk altayalp

View GitHub Profile
@altayalp
altayalp / FullMaximized.java
Created June 21, 2016 09:33
Simple swing fully maximized window example.
import java.awt.Dimension;
import javax.swing.JFrame;
/**
* Simple swing fully maximized window example.
*
* @author altayalp
*/
public class FullMaximized {
@altayalp
altayalp / event_scheduler.sql
Last active June 27, 2016 15:52
Mysql event scheduler. ( MySQL events is similar to a cron job in UNIX or a task scheduler in Windows. )
-- Check scheduler status before:
show processlist;
-- If you can see "event_scheduler" to user column, event scheduler is on. Else you must activate it.
SET GLOBAL event_scheduler = ON;
-- If you want to off event scheduler following this query.
@altayalp
altayalp / Person.php
Last active July 9, 2016 16:20
Php fluent interface (aka method chaining) example
<?php
/**
* Person class
*
* @author altayalp <[email protected]>
*/
class Person
{
private $name;
@altayalp
altayalp / get_user.sql
Created July 3, 2016 13:55
Get a list of MySQL user accounts
select user from mysql.user;
# or
select user, host from mysql.user;
# or
select * from mysql.user;
@altayalp
altayalp / HexBackgorundFrame.java
Created July 4, 2016 23:08
Simple example to set hex background color for the JFrame
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
/**
*
* @author altayalp
*/
public class HexBackgorundFrame {
@altayalp
altayalp / SimpleListView.java
Last active July 6, 2016 14:06
Simple javafx ListView example
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
/**
* Simple javafx listView example
@altayalp
altayalp / NotResizable.java
Created July 16, 2016 20:50
Java swing not maximized and resizabled window
import java.awt.Dimension;
import javax.swing.JFrame;
/**
*
* @author altayalp
*/
public class NotResizable {
public static void main(String[] args) {
NotResizable window = new NotResizable();
@altayalp
altayalp / SimpleComboBox.java
Last active July 25, 2016 19:13
Simple javafx ComboBox example
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
/**
@altayalp
altayalp / Classes.php
Created July 31, 2016 12:36
Php facade design pattern simple and complete example with dependency injection
<?php
class Validate implements ValidateInterface
{
public function isValid(array $data)
{
return true;
}
}
class Auth implements AuthInterface
@altayalp
altayalp / ispBad.php
Created August 1, 2016 23:46
ISP (Interface Segregation Principle) bad practice
<?php
interface MachineInterface
{
public function open();
public function heatWater();
public function makeCoffee();