Skip to content

Instantly share code, notes, and snippets.

View itorgov's full-sized avatar
🏠
Work at home

Ivan Torgov itorgov

🏠
Work at home
View GitHub Profile

Change Apple OS X Dock size from Apple Terminal

defaults write com.apple.dock tilesize -int 32; killall Dock

32 is icon size

@madkoding
madkoding / install-docker-deepin.sh
Last active May 23, 2024 10:08
Install Docker-CE script for Deepin Linux
#!/bin/bash
echo "Starting Docker installation on Deepin Linux..."
# Define a mapping from Deepin version to Debian version
map_deepin_to_debian() {
if [ "$1" -lt 20 ]; then
echo "stretch"
elif [ "$1" -ge 20 ]; then
echo "buster"
@ralphschindler
ralphschindler / AuthServiceProvider.php
Last active April 5, 2019 09:04
Laravel 5.8 Policy Guesser For Using "Models" Directory
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
@meSingh
meSingh / JsonMiddleware.php
Last active July 11, 2022 09:19
If you are using laravel as api only, you might want to return JSON on every request, even on errors/exceptions. The easiest way to do so is using this middleware globally.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class JsonMiddleware
{
public function handle(Request $request, Closure $next)
@fieldAbyss
fieldAbyss / bootstrap-4.blade.php
Last active May 26, 2020 14:25
Laravel Pagination Mobile Template bootstrap-4.blade.php
@if ($paginator->hasPages())
<ul class="pagination pagination-sm">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled"><span class="page-link">&laquo;</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
@if($paginator->currentPage() > 3)
@SeanSobey
SeanSobey / portainer.md
Last active June 12, 2024 07:40
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using host.docker.internal

This setup will let you run Portainer on windows by using the host.docker.internal endpoint (docker.for.win.localhost is depricated since docker version 3.2.1, but older versions may use this instead).

Please note:

@hauthorn
hauthorn / postman.desktop
Last active May 17, 2024 12:19
Postman desktop entry
[Desktop Entry]
Categories=Development;
Comment=Supercharge your API workflow
Exec="/home/hauthorn/Programs/Postman/Postman"
Icon=/home/hauthorn/Programs/Postman/app/resources/app/assets/icon.png
Name=Postman
Terminal=false
Type=Application
Version=1.0
@tomfun
tomfun / plural.js
Created August 23, 2016 12:31
JavaScript russian plural function
function getNoun(number, one, two, five) {
let n = Math.abs(number);
n %= 100;
if (n >= 5 && n <= 20) {
return five;
}
n %= 10;
if (n === 1) {
return one;
}
@nathggns
nathggns / base64url.php
Created September 21, 2013 18:34
base64url functionality for php
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}