Skip to content

Instantly share code, notes, and snippets.

@ChewySalmon
ChewySalmon / app.dockerfile
Last active March 8, 2024 14:00
Laravel development docker setup using PHP 8+, Nginx, MySql 8+, PhpMyAdmin and Mailhog. Includes all relevant service Dockerfiles and the Compose file. [GD edition]
FROM php:8.0-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
libwebp-dev \
--no-install-recommends \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo_mysql -j$(nproc) gd
@konratnox
konratnox / ajax.js
Last active May 26, 2021 15:33
Таймер(заготовка)
var timer = function() {
$.ajax({
url: '/scripts/timer.php',
type: 'post',
dataType: 'json',
data: {},
})
.done(function(data) {
console.log("success");
console.log(data);
@leonjza
leonjza / crypt.php
Last active May 18, 2022 15:34
Laravel ~5.1 encryptor / decryptor.
<?php
/*
* Quick 'n Dirty Laravel 5.1 decrypter.
*
* Based directly off the source code at:
* https://github.com/laravel/framework/blob/5.1/src/Illuminate/Encryption/Encrypter.php
*
* Have access to an application key from a .env?
* Have some encrypted data you want to decrypt?
* Well: (new Crypt($key))->decrypt($payload); should have you sorted
@forestmaxime
forestmaxime / DownloadBase64EncodedStringToFile.js
Created June 25, 2015 16:59
Download a base 64 encoded string to a file using javascript.
var filename = "";
var disposition = xhr.getResponseHeader('Content-Disposition');
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
var matches = filenameRegex.exec(disposition);
if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, "");
}
var contentType = xhr.getResponseHeader("Content-Type");
var blob = this.b64ToBlob(response, contentType);
@mtoigo
mtoigo / Controller
Created October 25, 2011 15:48
Kohana ORM Example
<?php
class Controller_Admin_Judges extends Controller_Admin_Base {
public function action_add() {
//Setting various view variables
$this->view->section_title = 'Add a New Judge';
$this->view->body = View::factory('admin/judges/form');
$this->view->body->button_text = 'Add Judge';
//Process our form POST