Skip to content

Instantly share code, notes, and snippets.

View mkotb's full-sized avatar

Mazen mkotb

  • Vancouver, BC, Canada.
View GitHub Profile
@mkotb
mkotb / uploader.php
Created July 20, 2014 02:35
PHP Script
<?php
// Path at-which you want to store your images in
$path = '/home/mazentheamazin/public_html/';
// The URI path at which images will be accessed (change as necessary).
$uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["file"]["tmp_name"];
@mkotb
mkotb / CacheMap.java
Last active August 29, 2015 14:04
Proper way to cache objects
import java.util.ArrayList;
import org.apache.commons.collections.MapIterator;
import org.apache.commons.collections.map.LRUMap;
public class CacheMap<K, V> {
private long timeToLive;
private LRUMap cacheMap;
public CacheMap(long timeToLive, final long timerInterval, int maxItems) {
@mkotb
mkotb / Modified SMTP by IvyBits
Last active August 29, 2015 14:01 — forked from GermanCoding/Modified SMTP (v.1.4) by IvyBits.java
Fixed indentation and syntax
package com.germancoding.email;
/**
* Copyright (c) 2014 Xiaomao Chen @ IvyBits
* All rights reserved.
*
*(Modified version by GermanCoding)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright