Skip to content

Instantly share code, notes, and snippets.

@mort3za
mort3za / git-auto-sign-commits.sh
Last active January 30, 2024 10:31
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@asvae
asvae / compare_laravel_and_doctrine_migrations.md
Last active November 13, 2020 18:43
Compare laravel and doctrine migrations

Let’s compare Laravel and Doctrine migrations

Laravel vs Doctrine

This article is targeted on Laravel beginners. No skills required whatsoever. Article is a tad opinionated, so take it with a grain of salt. Also, details are omitted for the sake of brevity.

In this article I will do the actual comparison as well as give several hints to get started.

If you’ve never heard of Doctrine, it is database abstraction layer. Sorta like Eloquent, but different type: Laravel is active record (AR), while Doctrine is object relational mapper (ORM).

Laravel migrations (docs)

@CodeMyUI
CodeMyUI / css3-snow-animation.markdown
Created November 25, 2016 04:22
CSS3 Snow Animation
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@sergejmueller
sergejmueller / goodbye-wordpress.md
Last active July 13, 2016 11:19
Goodbye, WordPress!

Goodbye, WordPress!

Fast 9 Jahre und nahezu 3 Millionen Downloads später ist Schluss.
Schluss mit WordPress.

Für mich geht ein Lebensabschnitt zu Ende. Ein Lebensabschnitt, der unendlich viel Erfahrung, Learnings und Spaß mit sich brachte. Ein Lebensabschnitt, der aber unendlich viel Zeit, Nerven und Motivation mit sich nahm. Doch der Wille zählt und ich hoffe stark, dass meine Software und mein Engagement die WordPress-Community ein Stückchen besser, qualitativer gemacht haben.

// Bitteschön

@drakakisgeo
drakakisgeo / gist:3bba2a2600b4c554f836
Created May 7, 2015 13:51
Auto trim all input [Laravel 5]
// Step 1. Create this class in the middleware folder.
<?php namespace App\Http\Middleware;
use Closure;
class BeforeAutoTrimmer {
/**
* Handle an incoming request.
@laracasts
laracasts / MailTestCase.php
Created June 14, 2014 22:35
Use Mailcatcher to test email.
<?php
use GuzzleHttp\Message\Response;
class MailTestCase extends TestCase {
protected $mailcatcher;
function __construct()
{
@amirkdv
amirkdv / php_mdb.rst
Last active August 25, 2023 13:14
How to handle MS Access MDB files in Linux with PHP5 PDO and ODBC

To be able to use PHP5 PDO with MS Access mdb files the following is required (the same applies for the PHP4 style of using odbc_X except for the obviously PDO specific requirements):

PHP ODBC module

In Linux this is achieved by intalling the php5-odbc package:

@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@hubgit
hubgit / glyphicon-spacing.css
Last active January 10, 2019 11:18
Spacing for Bootstrap Glyphicons in buttons
.btn .glyphicon {
margin-right: 4px;
vertical-align: middle;
}
.btn.btn-icon .glyphicon {
margin-right: 0;
}