Monthly Archiv: January, 2019

PHP Video Downloader Script (New)

Package:
PHP Video Downloader Script
Summary:
Discover and download a video using its page URL
Groups:
Files and Folders, PHP 5, Video
Author:
Kemal GENIS
Description:
This package can discover and download a video using its page URL...

Read more at https://www.phpclasses.org/package/11044-PHP-Discover-and-download-a-video-using-its-page-URL.html

PHP Video Downloader Script

Package:
PHP Video Downloader Script
Summary:
Discover and download a video using its page URL
Groups:
Files and Folders, PHP 5, Video
Author:
Kemal GENIS
Description:
This package can discover and download a video using its page URL...

Read more at https://www.phpclasses.org/package/11044-PHP-Discover-and-download-a-video-using-its-page-URL.html#2019-01-19-18:32:22

PHP AES GCM Encryption SIV

Package:
PHP AES GCM Encryption SIV
Summary:
Encrypt data with pure PHP code for Rijndael AES
Groups:
Cryptography, PHP 5
Author:
Jose Luis Lucas
Description:
This class can encrypt data with pure PHP code for Rijndael AES-GCM_SIV...

Read more at https://www.phpclasses.org/package/11021-PHP-Encrypt-data-with-pure-PHP-code-for-Rijndael-AES.html#2019-01-19-10:50:05

PHP Read More (New)

Package:
PHP Read More
Summary:
Cut a text to be displayed partially up to a limit
Groups:
PHP 5, Text processing
Author:
Malik umer Farooq
Description:
This is a very simple class that can cut a text to be displayed partially up to a limit...

Read more at https://www.phpclasses.org/package/11043-PHP-Cut-a-text-to-be-displayed-partially-up-to-a-limit.html

PHP Read More

Package:
PHP Read More
Summary:
Cut a text to be displayed partially up to a limit
Groups:
PHP 5, Text processing
Author:
Malik umer Farooq
Description:
This is a very simple class that can cut a text to be displayed partially up to a limit...

Read more at https://www.phpclasses.org/package/11043-PHP-Cut-a-text-to-be-displayed-partially-up-to-a-limit.html#2019-01-18-22:19:01

PHP AES GCM Encryption SIV

Package:
PHP AES GCM Encryption SIV
Summary:
Encrypt data with pure PHP code for Rijndael AES
Groups:
Cryptography, PHP 5
Author:
Jose Luis Lucas
Description:
This class can encrypt data with pure PHP code for Rijndael AES-GCM_SIV...

Read more at https://www.phpclasses.org/package/11021-PHP-Encrypt-data-with-pure-PHP-code-for-Rijndael-AES.html#2019-01-18-18:55:31

Weekly News for Designers № 471

CSS Grid Layout Generator – Create complex grids with this visual tool.
CSS Grid Layout Generator

When And How To Use CSS Multi-Column Layout – A look at this little-used alternative to Flexbox and CSS Grid.
When And How To Use CSS Multi-Column Layout

Incredible Code Snippets Inspired by Music – Creative examples that let you make music.
Incredible Code Snippets Inspired by Music

The internet, but not as we know it – A look at life online in China, Cuba, India and Russia.
The internet, but not as we know it

Destyle.css – An “opinionated” CSS reset library.
Destyle.css

Manrope – A free geometric sans-serif font family.
Manrope

Front-End Performance Checklist 2019 – An updated resource for building blazing-fast websites.
Front-End Performance Checklist 2019

The Case for Slowing Down the Design Process – How a slower pace can help you to produce a better final product.
The Case for Slowing Down the Design Process

An introduction to CSS Containment – Learn about this new standard, meant to improve browser performance.
An introduction to CSS Containment

2018 JavaScript Rising Stars – A look at JS projects that were much-loved on GitHub.
2018 JavaScript Rising Stars

Controlling WordPress Through the Command Line with WP-CLI – An introductory look at this powerful tool for WordPress.
Controlling WordPress Through the Command Line with WP-CLI

Anime.js – A lightweight JavaScript animation library.
Anime.js

Designing the Flexbox Inspector – Discover the benefits of this new browser inspection tool from Firefox.
Designing the Flexbox Inspector

Why we need CSS subgrid – A look at potential uses for creating a grid-within-a-grid.
Why we need CSS subgrid

Undernet – A modular, configuration-first front-end framework.
Undernet

Strategies to Improve Your Site’s Conversion Rate in 2019 – Use these techniques to boost conversions this year.
Strategies to Improve Your Site’s Conversion Rate in 2019

Follow Speckyboy on Twitter, Facebook or Google+ for a daily does of web design resources and freebies.

The post Weekly News for Designers № 471 appeared first on Speckyboy Web Design Magazine.

Calcular Frete Correios PHP Class (New)

Package:
Calcular Frete Correios PHP Class
Summary:
Calculate shipping costs for the Correios services
Groups:
E-Commerce, PHP 5, Web services
Author:
Manuel Lemos
Description:
This class can calculate the shipping costs for sending parcels using the Correios of Brazil post office company services...

Read more at https://www.phpclasses.org/package/11040-PHP-Calculate-shipping-costs-for-the-Correios-services.html

Calcular Frete Correios PHP Class

Package:
Calcular Frete Correios PHP Class
Summary:
Calculate shipping costs for the Correios services
Groups:
E-Commerce, PHP 5, Web services
Author:
Manuel Lemos
Description:
This class can calculate the shipping costs for sending parcels using the Correios of Brazil post office company services...

Read more at https://www.phpclasses.org/package/11040-PHP-Calculate-shipping-costs-for-the-Correios-services.html#2019-01-17-23:11:53

Creating a custom magic file database

The unix file utility command uses a "magic" database to determine which type of data a file contains, independently of the file's name or extension.

Here is how I created a custom magic database for testing purposes:

Test files

At first I created some files to run the tests on:

test.html
test.php
<?php echo 'foo'; ?>
test.23
Test 23

Let's see what the standard magic database detects here:

$ file test.*
test.23:   ASCII text
test.foo:  PHP script, ASCII text
test.html: html document, ASCII text

$ file -i test.*
test.23:   text/plain; charset=us-ascii
test.foo:  text/x-php; charset=us-ascii
test.html: text/html; charset=us-ascii

Magic database

The magic database contains the rules that are used to detect the type.

It's a plain text file with a rule on each line. Lines may refer to the previous line, so that rules can be combined. The full documentation is available in the magic man page.

Here is my simple file that detects "23" within the first 16 bytes of the file and returns the "text/x-23" MIME type:

my-magic
0 search/16 23 File containing "23"
!:mime text/x-23

We can already use it:

$ file -m my-magic test.23 
test.23: File containing "23", ASCII text

Compilation

If you want to use it many times, you should compile it to a binary file for speed reasons:

$ file -C -m my-magic
$ file -m my-magic.mgc test.*
test.23:   File containing "23", ASCII text
test.foo:  ASCII text
test.html: ASCII text

$ file -i -m my-magic.mgc test.*
test.23:   text/x-23; charset=us-ascii
test.foo:  text/plain; charset=us-ascii
test.html: text/plain; charset=us-ascii

The html and PHP files that have been detected properly earlier are not detected anymore, because my own magic database does not contain the rules of the standard magic file (/usr/share/misc/magic.mgc).

You may however pass multiple magic files to use, separated with a :

$ file -i -m my-magic.mgc:/usr/share/misc/magic.mgc test.*
test.23:   text/x-23; charset=us-ascii
test.foo:  text/x-php; charset=us-ascii
test.html: text/html; charset=us-ascii

Programming language detection

With this knowledge, I wrote a magic file that detects the programming language in source code files, so that phorkie can automatically choose the correct file extension: MIME_Type_PlainDetect.

Powered by Gewgley