Skip to content

Instantly share code, notes, and snippets.

View sayjeyhi's full-sized avatar
:electron:
Building things

Jafar Rezaei sayjeyhi

:electron:
Building things
View GitHub Profile
@sayjeyhi
sayjeyhi / php-html-css-js-minifier.php
Created October 22, 2016 09:55 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* ----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/engine/plug/converter.php`
* ----------------------------------------------------------------------------------------
*/
@sayjeyhi
sayjeyhi / isNumber.js
Created February 10, 2017 06:27
jquery number checker
$("input.isnumber").keydown(function(t) {
-1 !== $.inArray(t.keyCode, [46, 8, 9, 27, 13, 110, 190]) || 65 == t.keyCode && t.ctrlKey === !0 || 67 == t.keyCode && t.ctrlKey === !0 || 88 == t.keyCode && t.ctrlKey === !0 || t.keyCode >= 35 && t.keyCode <= 39 || (t.shiftKey || t.keyCode < 48 || t.keyCode > 57) && (t.keyCode < 96 || t.keyCode > 105) && t.preventDefault()
});
@sayjeyhi
sayjeyhi / isPersian.js
Created February 10, 2017 06:28
jquery persian letter checking helper helper
$("body").on("keypress", "input.isPersian", function(t) {
-1 !== $.inArray(t.keyCode, [46, 8, 9, 27, 13]) || (65 == t.charCode || 97 == t.charCode) && t.ctrlKey === !0 || t.keyCode >= 35 && t.keyCode <= 39 || -1 == $.inArray(String.fromCharCode(t.charCode), ["‌", " ", "آ", "ا", "ب", "پ", "ت", "ث", "ج", "چ", "ح", "خ", "د", "ذ", "ر", "ز", "ژ", "س", "ش", "ص", "ض", "ط", "ظ", "ع", "غ", "ف", "ق", "ک", "گ", "ل", "م", "ن", "و", "ه", "ی", "ي", "ك", "ة"]) && t.preventDefault()
});
<?php
class Automobile
{
private $vehicleMake;
private $vehicleModel;
public function __construct($make, $model)
{
$this->vehicleMake = $make;
$this->vehicleModel = $model;
<?php
interface OutputInterface
{
public function load();
}
class SerializedArrayOutput implements OutputInterface
{
public function load()
(0|\+98)?([ ]|,|-|[()]){0,2}9[1|2|3|4]([ ]|,|-|[()]){0,2}(?:[0-9]([ ]|,|-|[()]){0,2}){8}
<style>
html{direction:rtl;text-align:right;font-family: tahoma}
.isToday{background:#ccc;color:red}
</style>
<?php
require("jdate.php");
error_reporting(E_ALL);
ini_set('display_errors', 1);
<style>
html{direction:rtl;text-align:right;font-family: tahoma}
.isToday{background:#ccc;color:red}
</style>
<?php
function build_calendar($month,$year) {
// Create array containing abbreviations of days of week.
$daysOfWeek = array('S','M','T','W','T','F','S');
<?php
//Reduce errors
error_reporting(~E_WARNING);
//Create a UDP socket
if(!($sock = socket_create(AF_INET, SOCK_DGRAM, 0)))
{
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
https://codepen.io/lindell/pen/eZKBdO?editors=1010