Skip to content

Instantly share code, notes, and snippets.

[2014-06-26 11:46:45] local.INFO: 2703 ms & 301 files included & 355 classes included & "+"4.75mb. [] []
[2014-06-26 11:46:47] local.INFO: 1035 ms & 301 files included & 355 classes included & "+"4.75mb. [] []
[2014-06-26 11:46:50] local.INFO: 978 ms & 301 files included & 355 classes included & "+"4.75mb. [] []
[2014-06-26 11:46:53] local.INFO: 981 ms & 301 files included & 355 classes included & "+"4.75mb. [] []
[2014-06-26 11:46:53] local.INFO: 25 [] []
[2014-06-26 11:46:53] local.INFO: 50 [] []
[2014-06-26 11:46:53] local.INFO: 75 [] []
[2014-06-26 11:46:53] local.INFO: 100 [] []
[2014-06-26 11:46:53] local.INFO: 125 [] []
[2014-06-26 11:46:53] local.INFO: 150 [] []
@reshadman
reshadman / pusher.php
Last active August 29, 2015 14:03
Pusher logic
<?php
// I called following loop 5 times
for ($i = 1 ; $i <= 200; $i++)
{
\Queue::push(function ($job){
if (! \Cache::has('start_time')){
\Cache::put('start_time', time() , 1500); // global start time
}
sleep(10); //mock network delay for 25 requests
$id = 25; // number of async request
@reshadman
reshadman / timer.js
Created April 18, 2014 07:34
Javascript Timer
var s=0;
var m=0;
var h=0;
setInterval(function(){elecTimerHandler()},1000);
function elecTimerHandler(){
s++;
if (s>59){
s = 0;
@reshadman
reshadman / idIsValid.js
Created April 11, 2014 16:51
Persian ID Code
function idIsValid(code)
{
var L=code.length;
if(L<8 || parseInt(code,10)==0) return false;
code=('0000'+code).substr(L+4-10);
if(parseInt(code.substr(3,6),10)==0) return false;
var c=parseInt(code.substr(9,1),10);
var s=0;
<?php
# start session
session_start();
# if logged in name else make the name FALSE to make an access denied redirect
$name = (empty($_SESSION['username'])?false:$_SESSION['username']);
# Redirect if not logged in
if (!$name)
{
<?php
use Illuminate\Database\Migrations\Migration;
class CreatePersRolesTable extends Migration {
/**
* Run the migrations.
*
* @return void
<?php
class FileHandler {
/**
* allowable default file types
*/
public $enabled_mimes = array (
'image/png',
'image,jpg', #and what ever you want.
);