Skip to content

Instantly share code, notes, and snippets.

View mazhar266's full-sized avatar
💭
I may be slow to respond.

Mazhar Ahmed mazhar266

💭
I may be slow to respond.
View GitHub Profile
@mazhar266
mazhar266 / tyga.js
Last active August 29, 2015 14:06 — forked from thebyrd/tyga.js
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}
@mazhar266
mazhar266 / cal.php
Created October 15, 2014 10:51
Calendar in PHP
<?php
function year2array ($year)
{
$res = $year >= 1970;
if ($res)
{
// this line gets and sets same timezone, don't ask why :)
date_default_timezone_set ( date_default_timezone_get () );
@mazhar266
mazhar266 / strip.php
Created November 15, 2014 04:40
PHP's handy strip_tags( ) function removes HTML tags that look like <word...>, <word.../>, or </word>. However, it doesn't understand the tags it's removing. So We fixed it.
<?php
/**
* Remove HTML tags, including invisible text such as style and
* script code, and embedded objects. Add line breaks around
* block-level tags to prevent word joining after tag removal.
*/
function strip_html_tags( $text )
{
$text = preg_replace(
@mazhar266
mazhar266 / class.php
Created March 20, 2016 06:51
Zend Style Code Documentation
<?php
/**
* Short description for class
*
* Long description for class (if any)...
*
* @category Zend
* @package Zend_Magic
* @subpackage Wand
@mazhar266
mazhar266 / placeholder.css
Created March 27, 2016 06:37
Styling Placeholder Text
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
@mazhar266
mazhar266 / LoginController.java
Created July 30, 2016 23:06 — forked from jewelsea/LoginController.java
JavaFX sample for an fxml based Login screen to main application transition with login session data transfer
package login;
import javafx.event.*;
import javafx.fxml.FXML;
import javafx.scene.control.*;
/** Controls the login screen */
public class LoginController {
@FXML private TextField user;
@FXML private TextField password;
@mazhar266
mazhar266 / layered architecture.md
Last active March 2, 2019 17:29
Sprint MVC Basic Infos

In Spring MVC uses a layered architecture

controllers > services > repositories > models > database.

Controllers

hold the presentation (UI) logic – process user request (GET / POST / other), prepare data for the view and render the view (or redirect to another URL). Example: prepare and show the home page.

Services

hold the business logic. Often just call some repository method. Example: create new post / show a post for deleting / delete post. Services may have several implementations: DB based or stub based.

@mazhar266
mazhar266 / stuns
Created January 30, 2017 06:22 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@mazhar266
mazhar266 / stuns
Created January 30, 2017 06:23 — forked from yetithefoot/stuns
STUN+TURN servers list
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
@mazhar266
mazhar266 / kickstart.sh
Last active July 19, 2017 06:13 — forked from faisalmahmud/gist:e4c44c0dacacf01515dea1643929fcdb
Good starting point for a Django dev environment on Ubuntu
sudo apt-get update
sudo apt-get upgrade
# Install packages
sudo apt-get install -y python-pip python-dev build-essential python-software-properties
sudo apt-get install -y git-core htop nginx ntpdate nano ufw curl wget
sudo apt-get install -y zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev
sudo apt-get install -y libsqlite3-dev sqlite3
sudo apt-get install -y redis-server
sudo apt-get install -y nodejs npm