Skip to content

Instantly share code, notes, and snippets.

View mgsmus's full-sized avatar

Mustafa Akçakaya mgsmus

View GitHub Profile
@mgsmus
mgsmus / gist:3c7ed5e443f28c0f83e8684b508c359e
Created February 11, 2022 09:21 — forked from devodo/gist:8b39748d65e8185fbd89
PostgreSQL create UUID max aggregate function
CREATE OR REPLACE FUNCTION max (uuid, uuid)
RETURNS uuid AS $$
BEGIN
IF $1 IS NULL OR $1 < $2 THEN
RETURN $2;
END IF;
RETURN $1;
END;
$$ LANGUAGE plpgsql;
@mgsmus
mgsmus / AppServiceProvider.php
Created April 12, 2019 06:53 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@mgsmus
mgsmus / cryptor.php
Created November 20, 2018 13:08 — forked from petermuller71/cryptor.php
cryptor : PHP Encryption and decryption based on libsodium (standard lib >php7.2)
<?php
print "<h1>PHP Encryption with libsodium</h1>";
$message = "This text is secret";
$ciphertext = cryptor::encrypt("password", $message);
$plaintext = cryptor::decrypt("password", $ciphertext);
print "Message:<br />$message <br /><br />Ciphertext:<br />$ciphertext<br /><br />Plaintext:<br />$plaintext";
Resources marked with > are used, have been used, or are actively advocated in the threads. This applies for everything in the [Necessities] section.
[Necessities]
Hiragana & Katakana: http://www.realkana.com/
Kanji: http://kanjidamage.com/
Japanese IME: http://www.google.com/intl/ja/ime/
Anki Flashcards: http://ankisrs.net/
Genki (↓Bottom↓)
Tae Kim Japanese: http://www.guidetojapanese.org/learn/grammar
@mgsmus
mgsmus / function_v1.php
Created November 8, 2016 12:36 — forked from b-b3rn4rd/function_v1.php
Convert adjacency list into tree without recursion and second array.
<?php
function array_to_tree(array $array, $parent_id = 0)
{
$array = array_combine(array_column($array, 'id'), array_values($array));
foreach ($array as $k => &$v) {
if (isset($array[$v['parent_id']])) {
$array[$v['parent_id']]['children'][$k] = &$v;
}
@mgsmus
mgsmus / rgb_to_hex_to_rgb.php
Created October 4, 2016 00:55 — forked from Pushplaybang/rgb_to_hex_to_rgb.php
php functions convert hex to rgb and rgb to hex
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
@mgsmus
mgsmus / backup.php
Created February 7, 2016 17:24 — forked from toddsby/backup.php
backup.php
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
* contribution: Drew Toddsby
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
@echo off
rem Based on a gist for adding sublime text 2:
rem https://gist.github.com/mrchief/5628677
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with ST3" /t REG_SZ /v "" /d "Open with ST3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with ST3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
body.unresponsive {
min-width: 960px;
}
body.unresponsive .container {
max-width: none !important;
width: 960px !important;
}
body.unresponsive [class^="col-"] {
float: left;
}