Better MV-ish Framework – jsblocks

 

jsblocks

Better MV-ish Framework

From simple user interfaces to complex single-page applications using faster, server-side rendered and easy to learn framework

Advertisements

Generate short unique ids from integers

http://hashids.org/

Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers.

It converts numbers like 347 into strings like “yr8”, or array of numbers like [27, 986] into “3kTMd”.

You can also decode those ids back. This is useful in bundling several parameters into one or simply using them as short UIDs.

AdonisJs

AdonisJs is a true MVC Framework for Node Js. It encapsulate all the boring parts of Web programming and offers you a nice & clean API to work with.

 

Features

  • Routing

    AdonisJs has one of the most advanced routing engine with support of groups, named routes, subdomains, and controller bindings.

  • Ace Commands

    Ace is a fully baked command line tool shipped with Adonis. Not only you can make use of available commands, creating your own commands is just a matter of seconds.

  • Authentication System

    Inbuilt authentication layer to keep your applications secure with Sessions, JWT, Basic Auth and Personal API tokens.

  • ES2015 Controllers

    AdonisJs makes use of ES2015 features. You define your controllers as Classes and controller methods makes use of ES2015 generators

  • Emailer

    Sending emails is so simple and intutive with inbuilt drivers like Mailgun, Mandrill, SMTP and Amazon SES

  • Data Validator

    Validating data should be simple and fun. AdonisJs handmade validator makes it so simple to validate nested data with expressive set of rules.

  • Security Features

    All AdonisJs applications are pre-configured to handle CSRF, CORS, XSS and other Web attacks out of the box.

  • SQL Orm

    AdonisJs ORM ( Lucid ) is an implementation of Active Record. Leave your traditional SQL queries behind and make use of shiny data models.

  • Event Emitter

PHP LIST DIRECTORY AND PAGINATION CODE SAMPLE

PHP LIST DIRECTORY AND PAGINATION CODE SAMPLE

<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title><?php echo gethostname().”-PROJECTS”; ?></title>
</head>

<body>

<?php

$folders = glob(“*”, GLOB_ONLYDIR);
usort($folders, function ($a, $b) {
return filemtime($b) – filemtime($a);
});

$record_count  = 5;
$total_pages   = ceil(count($folders)/$record_count);
$page          = isset($_REQUEST[‘page’])?$_REQUEST[‘page’]:1; ///make it dyanamic :: page num
$offset        = ($page-1)*$record_count;
$folders_filter  = array_slice($folders, $offset,$record_count);

foreach ($folders_filter as $folder) {
echo “<a href=’$folder’>$folder</a> <br/>”;
}

if($total_pages > 1){
if($page != 1){
echo ‘<a href=”index.php?page=’.($page-1).'”>Prev</a>’;
}
if($page != $total_pages){
echo ‘<a href=”index.php?page=’.($page+1).'”>Next</a>’;
}
}
?>

</body>
</html>